diff --git a/deny.toml b/deny.toml index 68a7ee27d..aaabb1af3 100644 --- a/deny.toml +++ b/deny.toml @@ -72,7 +72,11 @@ yanked = "warn" # A list of advisory IDs to ignore. Note that ignored advisories will still # output a note when they are encountered. ignore = [ - #"RUSTSEC-0000-0000", + # time v0.3.44 stack overflow in format description parsing (via plist). + # Cannot upgrade to >=0.3.47 because it requires Rust 1.88 (edition 2024), + # which is above the current MSRV (1.83). Low risk for eza since time + # parsing input is not user-controlled. Will be resolved when MSRV is bumped. + "RUSTSEC-2026-0009", ] # Threshold for security vulnerabilities, any vulnerability with a CVSS score # lower than the range specified will be ignored. Note that ignored advisories diff --git a/src/main.rs b/src/main.rs index 7b2ac3701..2fef5c58f 100644 --- a/src/main.rs +++ b/src/main.rs @@ -12,7 +12,7 @@ use std::env; use std::ffi::{OsStr, OsString}; use std::io::{self, ErrorKind, IsTerminal, Read, Write, stdin}; -use std::path::{Component, PathBuf}; +use std::path::PathBuf; use std::process::exit; use nu_ansi_term::{AnsiStrings as ANSIStrings, Style}; @@ -266,7 +266,7 @@ impl Exa<'_> { self.options.filter.filter_argument_files(&mut files); self.print_files(None, files)?; - self.print_dirs(dirs, no_files, is_only_dir, exit_status) + self.print_dirs(dirs, no_files, is_only_dir, exit_status, 0) } fn print_dirs( @@ -275,6 +275,7 @@ impl Exa<'_> { mut first: bool, is_only_dir: bool, exit_status: i32, + depth: usize, ) -> io::Result { let View { file_style: file_name::Options { quote_style, .. }, @@ -340,14 +341,9 @@ impl Exa<'_> { self.options.filter.sort_files(&mut children); if let Some(recurse_opts) = self.options.dir_action.recurse_options() { - let depth = dir - .path - .components() - .filter(|&c| c != Component::CurDir) - .count() - + 1; + let child_depth = depth + 1; let follow_links = self.options.view.follow_links; - if !recurse_opts.tree && !recurse_opts.is_too_deep(depth) { + if !recurse_opts.tree && !recurse_opts.is_too_deep(child_depth) { let child_dirs = children .iter() .filter(|f| { @@ -361,7 +357,7 @@ impl Exa<'_> { .collect::>(); self.print_files(Some(dir), children)?; - match self.print_dirs(child_dirs, false, false, exit_status) { + match self.print_dirs(child_dirs, false, false, exit_status, child_depth) { Ok(_) => (), Err(e) => return Err(e), } diff --git a/tests/cmd/recurse_level_with_path_unix.stderr b/tests/cmd/recurse_level_with_path_unix.stderr new file mode 100644 index 000000000..e69de29bb diff --git a/tests/cmd/recurse_level_with_path_unix.stdout b/tests/cmd/recurse_level_with_path_unix.stdout new file mode 100644 index 000000000..d954b4624 --- /dev/null +++ b/tests/cmd/recurse_level_with_path_unix.stdout @@ -0,0 +1,31 @@ +a +b +c +d +dir-symlink -> vagrant/debug +e +exa +f +g +h +i +image.jpg.img.c.rs.log.png +index.svg +j +k +l +m +n +o +p +q +vagrant + +tests/itest/exa: +file.c -> djihisudjuhfius +sssssssssssssssssssssssssggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggsssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssss + +tests/itest/vagrant: +debug +dev +log diff --git a/tests/cmd/recurse_level_with_path_unix.toml b/tests/cmd/recurse_level_with_path_unix.toml new file mode 100644 index 000000000..a95089c99 --- /dev/null +++ b/tests/cmd/recurse_level_with_path_unix.toml @@ -0,0 +1,2 @@ +bin.name = "eza" +args = "-R --level=2 tests/itest" diff --git a/tests/gen/long_recurse_with_level_unix.toml b/tests/gen/long_recurse_with_level_unix.toml index 602667c23..732b23d59 100644 --- a/tests/gen/long_recurse_with_level_unix.toml +++ b/tests/gen/long_recurse_with_level_unix.toml @@ -1,2 +1,2 @@ bin.name = "eza" -args = "tests/test_dir --long --no-user --no-permissions --no-time --no-filesize --recurse --level 2" +args = "tests/test_dir --long --no-user --no-permissions --no-time --no-filesize --recurse --level 1"