patchbench / pilot /results /rust.jsonl
rootxhacker's picture
pilot rust: incremental 8 rows
3214e40 verified
Raw
History Blame Contribute Delete
87.5 kB
{"id": "patchbench-rust-real-0163", "repo": "pnpm/pnpm", "base_commit": "fecfe8334b47f0acb742a4d78f8cc9e50c64c52b", "status": "no_tests_parsed", "verify_status": null, "error": null, "timing": {"setup": 7.1, "pre_test_0": 235.5, "pre_test_1": 60.9, "post_test_0": 839.0, "post_test_1": 496.8, "total": 1640.3}, "test_cmds": ["cd /tmp/cache/repos/pnpm__pnpm ; CI=1 NO_COLOR=1 TERM=dumb setsid --wait cargo test --locked --workspace --no-fail-fast -- --test-threads=1 </dev/null 2>&1 | tee test-output.log"], "rebuild_cmds": [], "print_cmds": [], "f2p_pre_ok": true, "pre_detail": {"missing": 0, "wrong": [], "missing_ids": [], "parsed_count": 0}, "p2p_env_dropped_count": 0, "f2p_post_ok": false, "p2p_post_ok": true, "post_detail": {"missing": 0, "wrong": [["hoist::workspace_hoist_walks_every_importer", "fail"], ["custom_resolvers::should_refresh_resolution_forces_re_resolution_past_the_frozen_path", "fail"], ["pnpm_compatibility::same_global_virtual_store_layout_diamond", "fail"], ["pnpm_compatibility::same_global_virtual_store_layout_pure_js", "fail"], ["stale_pin_dedupe::refreshes_stale_transitive_pin_for_caret_range_direct_dep", "fail"], ["custom_resolvers::failing_should_refresh_resolution_aborts_the_install", "fail"], ["custom_resolvers::custom_resolver_receives_current_pkg_on_subsequent_installs", "fail"], ["stale_pin_dedupe::refreshes_stale_transitive_pin_to_higher_direct_dep_version", "fail"], ["hoist::public_hoist_star_hoists_to_root_node_modules", "fail"], ["hoist::private_hoist_pattern_filters_aliases", "fail"]], "missing_ids": [], "parsed_count": 5587}, "raw_tail": ".0.1 (/tmp/cache/repos/pnpm__pnpm/pacquet/crates/cli)\n Compiling itertools v0.13.0\n Compiling convert_case v0.11.0\n Compiling libloading v0.9.0\n Compiling cast v0.3.0\n Compiling ctor v1.0.8\n Compiling junction v2.0.0\n Compiling criterion-plot v0.8.2\n Compiling napi-sys v3.2.2\n Compiling napi-derive-backend v5.1.1\n Compiling ciborium v0.2.2\n Compiling plotters v0.3.7\n Compiling pacquet-napi v0.0.1 (/tmp/cache/repos/pnpm__pnpm/pacquet/crates/napi)\n Compiling tinytemplate v1.2.1\n Compiling page_size v0.6.0\n Compiling oorandom v11.1.5\n Compiling anes v0.1.6\n Compiling rustc-hash v2.1.2\n Compiling criterion v0.8.2\n Compiling napi-derive v3.5.9\n Compiling os_display v0.1.4\n Compiling project-root v0.2.2\n Compiling pacquet-micro-benchmark v0.0.0 (/tmp/cache/repos/pnpm__pnpm/pacquet/tasks/micro-benchmark)\n Compiling pacquet-integrated-benchmark v0.0.0 (/tmp/cache/repos/pnpm__pnpm/pacquet/tasks/integrated-benchmark)\nerror[E0432]: unresolved import `super::is_installed_globally`\n --> pacquet/crates/cli/src/cli_args/self_update/tests.rs:1:27\n |\n1 | use super::{install_pnpm, is_installed_globally, update_version_constraint, version_lt};\n | ^^^^^^^^^^^^^^^^^^^^^ no `is_installed_globally` in `cli_args::self_update`\n\nFor more information about this error, try `rustc --explain E0432`.\nerror: could not compile `pacquet-cli` (lib test) due to 1 previous error\nwarning: build failed, waiting for other jobs to finish...\n\n\n"}
{"id": "patchbench-rust-real-0028", "repo": "lalrpop/lalrpop", "base_commit": "21f605036a45223139707ce35dcbd02166d2b0d7", "status": "no_tests_parsed", "verify_status": null, "error": null, "timing": {"setup": 2.5, "pre_test_0": 93.5, "pre_test_1": 75.5, "post_test_0": 93.1, "post_test_1": 0.8, "total": 265.5}, "test_cmds": ["cargo test --workspace 2>&1 | tee test-output.log"], "rebuild_cmds": [], "print_cmds": [], "f2p_pre_ok": true, "pre_detail": {"missing": 0, "wrong": [], "missing_ids": [], "parsed_count": 0}, "p2p_env_dropped_count": 0, "f2p_post_ok": false, "p2p_post_ok": true, "post_detail": {"missing": 16, "wrong": [["verify_lalrpop_generates_itself", "fail"]], "missing_ids": ["tests::test", "fair_ball", "flyball", "nobol7", "popfly - should panic"], "parsed_count": 323}, "raw_tail": " numeric grouping `,` is not supported in rust format strings\n --> /tmp/pb-cargo-target/debug/build/lalrpop-test-259c049af668be29/out/match_section.rs:1324:18\n |\n1324 | format!(\"{__0, __1} {__0, __1}\")\n | - ^ expected `}` in format string\n | |\n | because of this opening brace\n |\n = note: to print `{`, you can escape it using `{{`\n\nerror: invalid format string: python's numeric grouping `,` is not supported in rust format strings\n --> /tmp/pb-cargo-target/debug/build/lalrpop-test-259c049af668be29/out/match_section_byte.rs:1324:18\n |\n1324 | format!(\"{__0, __1} {__0, __1}\")\n | - ^ expected `}` in format string\n | |\n | because of this opening brace\n |\n = note: to print `{`, you can escape it using `{{`\n\nerror: invalid format string: python's numeric grouping `,` is not supported in rust format strings\n --> /tmp/pb-cargo-target/debug/build/lalrpop-test-259c049af668be29/out/match_alternatives.rs:814:18\n |\n814 | format!(\"{__0, __1} {__0, __1}\")\n | - ^ expected `}` in format string\n | |\n | because of this opening brace\n |\n = note: to print `{`, you can escape it using `{{`\n\nerror: could not compile `lalrpop-test` (lib) due to 6 previous errors\nwarning: build failed, waiting for other jobs to finish...\nerror: could not compile `lalrpop-test` (lib test) due to 6 previous errors\n\n\n"}
{"id": "patchbench-rust-real-0006", "repo": "gleam-lang/gleam", "base_commit": "157111df6070643addae3f2fd70a888c508f6973", "status": "no_tests_parsed", "verify_status": null, "error": null, "timing": {"setup": 3.4, "pre_test_0": 105.3, "pre_test_1": 19.8, "post_test_0": 108.9, "post_test_1": 20.2, "total": 257.9}, "test_cmds": ["cargo test --workspace -v 2>&1 | tee test-output.log"], "rebuild_cmds": [], "print_cmds": [], "f2p_pre_ok": true, "pre_detail": {"missing": 0, "wrong": [], "missing_ids": [], "parsed_count": 0}, "p2p_env_dropped_count": 4487, "f2p_post_ok": false, "p2p_post_ok": true, "post_detail": {"missing": 60, "wrong": [], "missing_ids": ["generated_tests::erlang_app_generation", "generated_tests::javascript_d_ts", "tests::echo::echo_bitarray", "erlang::tests::inlining::inlining_works_properly_with_record_updates", "generated_tests::with_dep_dev"], "parsed_count": 0}, "raw_tail": "f62ddb681415868.rlib --extern radix_trie=/tmp/pb-cargo-target/debug/deps/libradix_trie-4d0baf70699784c7.rlib --extern rand=/tmp/pb-cargo-target/debug/deps/librand-8f1299d2db8153c8.rlib --extern regex=/tmp/pb-cargo-target/debug/deps/libregex-9fc5ed5a16783ac7.rlib --extern serde=/tmp/pb-cargo-target/debug/deps/libserde-3de1068ace139ab1.rlib --extern serde_json=/tmp/pb-cargo-target/debug/deps/libserde_json-6d91bb54176aafe2.rlib --extern spdx=/tmp/pb-cargo-target/debug/deps/libspdx-f15ca2df0dbfe7b8.rlib --extern stacker=/tmp/pb-cargo-target/debug/deps/libstacker-c04d8338e6eb692a.rlib --extern strum=/tmp/pb-cargo-target/debug/deps/libstrum-7fc2cd47f00dc6a0.rlib --extern tar=/tmp/pb-cargo-target/debug/deps/libtar-559bd4e347a9a6d1.rlib --extern termcolor=/tmp/pb-cargo-target/debug/deps/libtermcolor-c91e7b087907efb2.rlib --extern thiserror=/tmp/pb-cargo-target/debug/deps/libthiserror-93e9590fa5eca502.rlib --extern toml=/tmp/pb-cargo-target/debug/deps/libtoml-8761c1fd0b17f839.rlib --extern tracing=/tmp/pb-cargo-target/debug/deps/libtracing-8d591a5950ce3c4e.rlib --extern unicode_segmentation=/tmp/pb-cargo-target/debug/deps/libunicode_segmentation-ee075e926fc62ff9.rlib --extern vec1=/tmp/pb-cargo-target/debug/deps/libvec1-ac8556c142884259.rlib --extern xxhash_rust=/tmp/pb-cargo-target/debug/deps/libxxhash_rust-83471dc468e35368.rlib -L native=/tmp/pb-cargo-target/debug/build/ring-9c4204c0a5b7ff1b/out -L native=/tmp/pb-cargo-target/debug/build/psm-bca60044526678b7/out` (exit status: 1)\n\n\n"}
{"id": "patchbench-rust-real-0070", "repo": "eza-community/eza", "base_commit": "1e82e8630401272fbac3ffe1d4bc71bdc436df74", "status": "verified", "verify_status": "verified", "error": null, "timing": {"setup": 1.1, "pre_test_0": 65.3, "pre_test_1": 1.2, "post_test_0": 55.6, "post_test_1": 1.1, "total": 124.5}, "test_cmds": ["cd /tmp/cache/repos/eza-community__eza && mkdir -p reports && cargo test --workspace -v 2>&1 | tee reports/test-output.log"], "rebuild_cmds": [], "print_cmds": [], "f2p_pre_ok": true, "pre_detail": {"missing": 0, "wrong": [], "missing_ids": [], "parsed_count": 343}, "p2p_env_dropped_count": 0, "f2p_post_ok": true, "p2p_post_ok": true, "post_detail": {"missing": 0, "wrong": [], "missing_ids": [], "parsed_count": 344}, "raw_tail": "ps/librayon-878a2b7cf8e65aca.rlib --extern serde=/tmp/pb-cargo-target/debug/deps/libserde-a17865ecf9dafcda.rlib --extern serde_norway=/tmp/pb-cargo-target/debug/deps/libserde_norway-8021348872ad965a.rlib --extern terminal_size=/tmp/pb-cargo-target/debug/deps/libterminal_size-b3fa26fd57b8cd25.rlib --extern timeago=/tmp/pb-cargo-target/debug/deps/libtimeago-c991441886b9f95c.rlib --extern trycmd=/tmp/pb-cargo-target/debug/deps/libtrycmd-772cba9e1cbdab3f.rlib --extern unicode_width=/tmp/pb-cargo-target/debug/deps/libunicode_width-6090f0301c41ec65.rlib --extern unit_prefix=/tmp/pb-cargo-target/debug/deps/libunit_prefix-bb88989da459d7ed.rlib --extern term_grid=/tmp/pb-cargo-target/debug/deps/libterm_grid-2196aa51ba05e7d2.rlib --extern uzers=/tmp/pb-cargo-target/debug/deps/libuzers-bd9fe2dd9e4d75d6.rlib -C embed-bitcode=no --cfg 'feature=\"default\"' --cfg 'feature=\"git\"' --cfg 'feature=\"git2\"' --check-cfg 'cfg(docsrs,test)' --check-cfg 'cfg(feature, values(\"default\", \"git\", \"git2\", \"nix\", \"nix-generated\", \"nix-local\", \"powertest\", \"vendored-libgit2\", \"vendored-openssl\"))' --error-format human`\n\nrunning 3 tests\ntest src/fs/recursive_size.rs - fs::recursive_size::RecursiveSize::is_none (line 27) ... ok\ntest src/fs/recursive_size.rs - fs::recursive_size::RecursiveSize::map_or (line 70) ... ok\ntest src/fs/recursive_size.rs - fs::recursive_size::RecursiveSize::unwrap_bytes_or (line 49) ... ok\n\ntest result: ok. 3 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s\n\n\n", "context_files": [{"path": "src/options/file_name.rs", "content": "// SPDX-FileCopyrightText: 2024 Christina S\u00f8rensen\n// SPDX-License-Identifier: EUPL-1.2\n//\n// SPDX-FileCopyrightText: 2023-2024 Christina S\u00f8rensen, eza contributors\n// SPDX-FileCopyrightText: 2014 Benjamin Sago\n// SPDX-License-Identifier: MIT\nuse crate::options::parser::ShowWhen;\nuse crate::options::vars::{self, Vars};\nuse crate::options::{NumberSource, OptionsError};\n\nuse crate::output::file_name::{Classify, EmbedHyperlinks, Options, QuoteStyle, ShowIcons};\n\nuse clap::ArgMatches;\n\nimpl Options {\n pub fn deduce<V: Vars>(\n matches: &ArgMatches,\n vars: &V,\n is_a_tty: bool,\n ) -> Result<Self, OptionsError> {\n let classify = Classify::deduce(matches);\n let show_icons = ShowIcons::deduce(matches, vars)?;\n\n let quote_style = QuoteStyle::deduce(matches);\n let embed_hyperlinks = EmbedHyperlinks::deduce(matches);\n\n let absolute = *matches.get_one(\"absolute\").unwrap();\n\n Ok(Self {\n classify,\n show_icons,\n quote_style,\n embed_hyperlinks,\n absolute,\n is_a_tty,\n })\n }\n}\n\nimpl Classify {\n fn deduce(matches: &ArgMatches) -> Self {\n match matches.get_one(\"classify\") {\n Some(ShowWhen::Auto) => Self::AutomaticAddFileIndicators,\n Some(ShowWhen::Always) => Self::AddFileIndicators,\n None | Some(ShowWhen::Never) => Self::JustFilenames,\n }\n }\n}\n\nimpl ShowIcons {\n pub fn deduce<V: Vars>(matches: &ArgMatches, vars: &V) -> Result<Self, OptionsError> {\n let force_icons = vars.get(vars::EZA_ICONS_AUTO).is_some();\n let mode_opt = &matches.get_one(\"icons\");\n if !force_icons && mode_opt.is_none() {\n return Ok(Self::Never);\n }\n\n match mode_opt {\n Some(ShowWhen::Never) => Ok(Self::Never),\n Some(ShowWhen::Always) => Ok(Self::Always(Self::get_width(vars)?)),\n Some(ShowWhen::Auto) | None => Ok(Self::Automatic(Self::get_width(vars)?)),\n }\n }\n\n fn get_width<V: Vars>(vars: &V) -> Result<u32, OptionsError> {\n if let Some(columns) = vars\n .get_with_fallback(vars::EXA_ICON_SPACING, vars::EZA_ICON_SPACING)\n .map(|s| s.to_string_lossy().to_string())\n {\n match columns.parse() {\n Ok(width) => Ok(width),\n Err(e) => {\n let source = NumberSource::Env(\n vars.source(vars::EXA_ICON_SPACING, vars::EZA_ICON_SPACING)\n .unwrap_or(\"1\"),\n );\n Err(OptionsError::FailedParse(columns.clone(), source, e))\n }\n }\n } else {\n Ok(1)\n }\n }\n}\n\nimpl QuoteStyle {\n pub fn deduce(matches: &ArgMatches) -> Self {\n if matches.get_flag(\"no-quotes\") {\n Self::NoQuotes\n } else {\n Self::QuoteSpaces\n }\n }\n}\n\nimpl EmbedHyperlinks {\n fn deduce(matches: &ArgMatches) -> Self {\n match matches.get_one(\"hyperlink\") {\n Some(ShowWhen::Never) | None => Self::Never,\n Some(ShowWhen::Always) => Self::Always,\n Some(ShowWhen::Auto) => Self::Automatic,\n }\n }\n}\n\n#[cfg(test)]\nmod tests {\n use std::ffi::OsString;\n use std::num::ParseIntError;\n\n use super::*;\n use crate::options::parser::ShowWhen;\n use crate::options::parser::test::mock_cli;\n use crate::options::vars::test::MockVars;\n use crate::output::file_name::Absolute;\n\n use clap::ValueEnum;\n\n #[test]\n fn deduce_classify_file_indicators() {\n assert_eq!(\n Classify::deduce(&mock_cli(vec![\"--classify\"])),\n Classify::AutomaticAddFileIndicators\n );\n }\n\n #[test]\n fn deduce_classify_just_filenames() {\n assert_eq!(\n Classify::deduce(&mock_cli(vec![\"\"])),\n Classify::JustFilenames\n );\n }\n\n #[test]\n fn deduce_quote_style_no_quotes() {\n assert_eq!(\n QuoteStyle::deduce(&mock_cli(vec![\"--no-quotes\"])),\n QuoteStyle::NoQuotes\n );\n }\n\n #[test]\n fn deduce_quote_style_quote_spaces() {\n assert_eq!(\n QuoteStyle::deduce(&mock_cli(vec![\"\"])),\n QuoteStyle::QuoteSpaces\n );\n }\n\n #[test]\n fn deduce_embed_hyperlinks_auto() {\n assert_eq!(\n EmbedHyperlinks::deduce(&mock_cli(vec![\"--hyperlink\"])),\n EmbedHyperlinks::Automatic\n );\n assert_eq!(\n EmbedHyperlinks::deduce(&mock_cli(vec![\"--hyperlink\", \"auto\"])),\n EmbedHyperlinks::Automatic\n );\n }\n\n #[test]\n fn deduce_embed_hyperlinks_always() {\n assert_eq!(\n EmbedHyperlinks::deduce(&mock_cli(vec![\"--hyperlink\", \"always\"])),\n EmbedHyperlinks::Always\n );\n }\n\n #[test]\n fn deduce_embed_hyperlinks_never() {\n assert_eq!(\n EmbedHyperlinks::deduce(&mock_cli(vec![\"--hyperlink\", \"never\"])),\n EmbedHyperlinks::Never\n );\n assert_eq!(\n EmbedHyperlinks::deduce(&mock_cli(vec![\"\"])),\n EmbedHyperlinks::Never\n );\n }\n\n #[test]\n fn deduce_show_icons_never_no_arg() {\n assert_eq!(\n ShowIcons::deduce(&mock_cli(vec![\"\"]), &MockVars::default()),\n Ok(ShowIcons::Never)\n );\n }\n\n #[test]\n fn deduce_show_icons_never_no_arg_env() {\n let mut vars = MockVars::default();\n vars.set(vars::EZA_ICONS_AUTO, &OsString::from(\"1\"));\n assert_eq!(\n ShowIcons::deduce(&mock_cli(vec![\"\"]), &vars),\n Ok(ShowIcons::Automatic(1))\n );\n }\n\n #[test]\n fn deduce_show_icon_always() {\n assert_eq!(\n ShowIcons::deduce(&mock_cli(vec![\"--icons\", \"always\"]), &MockVars::default()),\n Ok(ShowIcons::Always(1)),\n );\n }\n\n #[test]\n fn deduce_show_icons_never() {\n assert_eq!(\n ShowIcons::deduce(&mock_cli(vec![\"--icons\", \"never\"]), &MockVars::default()),\n Ok(ShowIcons::Never)\n );\n }\n\n #[test]\n fn deduce_show_icons_auto() {\n assert_eq!(\n ShowIcons::deduce(&mock_cli(vec![\"--icons\", \"auto\"]), &MockVars::default()),\n Ok(ShowIcons::Automatic(1))\n );\n }\n\n #[test]\n fn deduce_show_icons_error() {\n assert_eq!(\n ShowWhen::from_str(\"foo\", false)\n .map_err(|err| OptionsError::BadArgument(\"icons\", err.into())),\n Err(OptionsError::BadArgument(\"icons\", OsString::from(\"foo\")))\n );\n }\n\n #[test]\n fn deduce_show_icons_width() {\n let mut vars = MockVars::default();\n vars.set(vars::EZA_ICON_SPACING, &OsString::from(\"3\"));\n assert_eq!(\n ShowIcons::deduce(&mock_cli(vec![\"--icons\"]), &vars),\n Ok(ShowIcons::Automatic(3))\n );\n }\n\n #[test]\n fn deduce_show_icons_width_error() {\n let mut vars = MockVars::default();\n vars.set(vars::EZA_ICON_SPACING, &OsString::from(\"foo\"));\n\n let e: Result<i64, ParseIntError> = vars\n .get(vars::EZA_ICON_SPACING)\n .unwrap()\n .to_string_lossy()\n .parse();\n\n assert_eq!(\n ShowIcons::deduce(&mock_cli(vec![\"--icons\", \"auto\"]), &vars),\n Err(OptionsError::FailedParse(\n String::from(\"foo\"),\n NumberSource::Env(vars::EXA_ICON_SPACING),\n e.unwrap_err()\n ))\n );\n }\n\n #[test]\n fn deduce_options() {\n assert_eq!(\n Options::deduce(&mock_cli(vec![\"\"]), &MockVars::default(), true),\n Ok(Options {\n classify: Classify::JustFilenames,\n show_icons: ShowIcons::Never,\n quote_style: QuoteStyle::QuoteSpaces,\n embed_hyperlinks: EmbedHyperlinks::Never,\n absolute: Absolute::Off,\n is_a_tty: true,\n })\n );\n }\n}\n"}, {"path": "src/options/parser.rs", "content": "// SPDX-FileCopyrightText: 2024 Christina S\u00f8rensen\n// SPDX-License-Identifier: EUPL-1.2\n//\n// SPDX-FileCopyrightText: 2023-2024 Christina S\u00f8rensen, eza contributors\n// SPDX-FileCopyrightText: 2014 Benjamin Sago\n// SPDX-License-Identifier: MIT\nuse std::ffi::OsString;\n\nuse clap::{Error, ValueEnum, arg, builder::PossibleValue, value_parser};\n\nuse crate::{\n fs::filter::{SortCase, SortField},\n output::{file_name::Absolute, time::TimeFormat},\n};\n\nconst SORT_FIELDS_HELP: &str = \"[default: name] [possible values:\n name, Name, .name, .Name, ext, ext, created,\n date, age, accessed, changed,\n size, inode, type, none]\";\n\nconst TIME_FIELDS_HELP: &str = \"[possible values:\n mod|modified, acc|accessed, ch|changed, cr|created]\";\n\nconst FORMAT_STYLE_FIELDS_HELP: &str = \"[possible values:\n default, iso, long-iso, full-iso, relative, \\\"+<CUSTOM_FORMAT>\\\"]\";\n\npub fn get_command() -> clap::Command {\n clap::Command::new(clap::crate_name!())\n .author(clap::crate_authors!())\n .about(clap::crate_description!())\n .version(include_str!(concat!(env!(\"OUT_DIR\"), \"/version_string.txt\")))\n .disable_help_flag(true)\n .disable_version_flag(true)\n .args_override_self(true)\n\n .arg(arg!([FILE]...).value_parser(clap::value_parser!(OsString)).hide_short_help(true))\n\n .next_help_heading(\"META OPTIONS\")\n .arg(arg!(--stdin \"read file names from stdin\"))\n .arg(arg!(-'?' --help \"Print help\").action(clap::ArgAction::HelpShort))\n .arg(arg!(-v --version \"Print help\").action(clap::ArgAction::Version))\n\n .next_help_heading(\"LAYOUT OPTIONS\")\n .arg(arg!(-'1' --oneline \"display one entry per line\"))\n .arg(arg!(-l --long \"display extended file metadata as a table\"))\n .arg(arg!(-G --grid \"display entries as a grid (default)\"))\n .arg(arg!(-x --across \"sort the grid across, rather than downwards\"))\n .arg(arg!(-R --recurse \"recurse into directories\"))\n .arg(arg!(-T --tree \"recurse into directories as a tree\"))\n .arg(arg!(-L --level <DEPTH> \"limit the depth of recursion\")\n .value_parser(value_parser!(usize)))\n .arg(arg!(--\"follow-symlinks\" \"drill down into symbolic links that point to directories\"))\n .arg(arg!(-w --width <COLS> \"set screen width in columns\")\n .value_parser(value_parser!(usize)))\n\n .next_help_heading(\"DISPLAY OPTIONS\")\n .arg(arg!(-F --classify <WHEN> \"display type indicator by file names\")\n .num_args(0..=1)\n .value_parser(value_parser!(ShowWhen))\n .default_missing_value(\"auto\"))\n .arg(arg!(-X --dereference \"dereference symbolic links when displaying information\"))\n .arg(arg!(--absolute \"display entries with their absolute path\")\n .num_args(0..=1)\n .action(clap::ArgAction::Set)\n .value_parser(value_parser!(Absolute))\n .default_missing_value(\"on\")\n .default_value(\"off\")\n .hide_default_value(true))\n .arg(arg!(--color <WHEN> \"When to use colours.\")\n .alias(\"colour\")\n .num_args(0..=1)\n .value_parser(value_parser!(ShowWhen))\n .default_missing_value(\"auto\")\n .default_value(\"auto\"))\n .arg(arg!(--\"color-scale\" <FIELDS> \"highlight value of FIELDS distinctly\")\n .num_args(0..)\n .value_parser(value_parser!(ColorScaleArgs))\n .default_missing_value(\"all\")\n .value_delimiter(','))\n .arg(arg!(--\"color-scale-mode\" <MODE> \"mode for --color-scale\")\n .num_args(1)\n .value_parser(value_parser!(ColorScaleModeArgs))\n .default_value(\"gradient\"))\n .arg(arg!(--icons <WHEN> \"when to display icons\")\n .num_args(0..=1)\n .value_parser(value_parser!(ShowWhen))\n .default_missing_value(\"auto\"))\n .arg(arg!(--hyperlink <WHEN> \"when to display entries as hyperlinks\")\n .num_args(0..=1)\n .value_parser(value_parser!(ShowWhen))\n .default_missing_value(\"auto\"))\n .arg(arg!(--\"no-quotes\" \"don't quote file names with spaces\"))\n\n .next_help_heading(\"FILTERING OPTIONS\")\n .arg(arg!(-a --all... \"show hidden files. Use this twice to also show the '.' and '..' directories\"))\n .arg(arg!(-A --\"almost-all\" \"equivalent to --all; included for compatibility with `ls -A`\"))\n .arg(arg!(-d --\"treat-dirs-as-files\" \"treat directories as files; don't list their contents\")\n .alias(\"list-dirs\") // TODO: compat alias to remove (above flag published in v0.23.4 / 2025-10-03)\n .conflicts_with_all([\"recurse\", \"tree\"]))\n .arg(arg!(-D --\"only-dirs\" \"list only directories\"))\n .arg(arg!(-f --\"only-files\" \"list only files\"))\n .arg(arg!(--\"show-symlinks\" \"explicitly show symbolic links (with --only-dirs and --only-files)\"))\n .arg(arg!(--\"no-symlinks\" \"do not show symbolic links\"))\n .arg(arg!(-I --\"ignore-glob\" <GLOBS> \"glob patterns (pipe-separated) of files to ignore\"))\n .arg(arg!(--\"git-ignore\" \"ignore files mentioned in '.gitignore'\"))\n\n .next_help_heading(\"SORTING OPTIONS\")\n .arg(arg!(--\"group-directories-first\" \"list directories before other files\").id(\"dirs-first\"))\n .arg(arg!(--\"group-directories-last\" \"list directories after other files\").id(\"dirs-last\"))\n .arg(arg!(-s --sort <FIELD>)\n .help(format!(\"which field to sort by {SORT_FIELDS_HELP}\"))\n .value_parser(value_parser!(SortField))\n .default_value(\"name\")\n .hide_default_value(true)\n .hide_possible_values(true))\n .arg(arg!(-r --reverse \"reverse the sort order\"))\n\n .next_help_heading(\"LONG VIEW OPTIONS\")\n .arg(arg!(-h --header \"add a header row to each column\"))\n .arg(arg!(-i --inode \"list each file's inode number\"))\n .arg(arg!(-o --\"octal-permissions\" \"list each file's permission in octal format\"))\n .arg(arg!(-H --links \"list each file's number of hard links\"))\n .arg(arg!(-b --binary \"show file sizes with binary prefixes\"))\n .arg(arg!(-B --bytes \"show file sizes in bytes, without any prefixes\"))\n .arg(arg!(--\"total-size\" \"show the size of a directory as the one of its content (unix only)\"))\n .arg(arg!(-S --blocksize \"list size of allocated file system blocks\"))\n .arg(arg!(-g --group \"list each file's group\"))\n .arg(arg!(--\"smart-group\" \"only show group if it has a different name from owner\"))\n .arg(arg!(-n --numeric \"show user and group as their numeric IDs\"))\n .arg(arg!(-t --time <FIELD>).help(format!(\"which timestamp field to show {TIME_FIELDS_HELP}\"))\n .value_parser(value_parser!(TimeArgs))\n .conflicts_with_all([\"modified\", \"accessed\", \"changed\", \"created\"])\n .hide_possible_values(true))\n .arg(arg!(-m --modified \"show the modified timestamp field (replace default field, combinable)\"))\n .arg(arg!(-u --accessed \"show the accessed timestamp field (replace default field, combinable)\"))\n .arg(arg!(--changed \"show the changed timestamp field (replace default field, combinable)\"))\n .arg(arg!(-U --created \"show the created timestamp field (replace default field, combinable)\"))\n .arg(arg!(--\"time-style\" <STYLE>)\n .help(format!(\"how to format timestamps {FORMAT_STYLE_FIELDS_HELP}\"))\n .value_parser(TimeFormatParser)\n .hide_possible_values(false))\n .arg(arg!(-O --flags \"list file flags (Mac, BSD, and Windows only)\").id(\"file-flags\"))\n .arg(arg!(-Z --context \"list each file's security context\").id(\"security-context\"))\n .arg(arg!(--git \"list each file's Git status, if tracked or ignored\"))\n .arg(arg!(--\"git-repos\" \"list root of git-tree status\"))\n .arg(arg!(--\"git-repos-no-status\" \"list each git-repos branch name (much faster)\"))\n .arg(arg!(-M --mounts \"show mount details (Linux and macOS only)\"))\n .arg(arg!(-'@' --extended \"list each file's extended attributes and sizes\"))\n .arg(arg!(--\"no-permissions\" \"suppress the permissions field\"))\n .arg(arg!(--\"no-filesize\" \"suppress the filesize field\"))\n .arg(arg!(--\"no-user\" \"suppress the user field\"))\n .arg(arg!(--\"no-time\" \"suppress the time field\"))\n .arg(arg!(--\"no-git\" \"suppress Git fields (overrides --git, --git-repos, --git-repos-no-status)\"))\n}\n\n#[derive(Clone, Debug, PartialEq, Eq)]\npub enum ShowWhen {\n // icons, colors, quotes, headers ? eventually\n Always,\n Auto,\n Never,\n}\n\nimpl ValueEnum for ShowWhen {\n fn value_variants<'a>() -> &'a [Self] {\n &[Self::Always, Self::Auto, Self::Never]\n }\n\n fn to_possible_value(&self) -> Option<clap::builder::PossibleValue> {\n Some(\n match self {\n Self::Always => \"always\",\n Self::Auto => \"auto\",\n Self::Never => \"never\",\n }\n .into(),\n )\n }\n\n fn from_str(s: &str, _ignore_case: bool) -> Result<Self, String> {\n match s.to_lowercase().as_str() {\n \"\" | \"auto\" | \"automatic\" => Ok(Self::Auto),\n \"always\" => Ok(Self::Always),\n \"never\" => Ok(Self::Never),\n e => Err(String::from(e)),\n }\n }\n}\n\n#[derive(Clone, Debug, ValueEnum, PartialEq, Eq)]\npub enum ColorScaleArgs {\n All,\n Age,\n Size,\n}\n\n#[derive(Clone, Debug, ValueEnum, PartialEq, Eq)]\npub enum ColorScaleModeArgs {\n Fixed,\n Gradient,\n}\n\nimpl ValueEnum for SortField {\n fn value_variants<'a>() -> &'a [Self] {\n &[\n Self::Name(SortCase::AaBbCc),\n Self::Name(SortCase::ABCabc),\n Self::NameMixHidden(SortCase::AaBbCc),\n Self::NameMixHidden(SortCase::ABCabc),\n Self::Size,\n Self::Extension(SortCase::AaBbCc),\n Self::Extension(SortCase::ABCabc),\n Self::ModifiedDate,\n Self::ModifiedAge,\n Self::ChangedDate,\n Self::AccessedDate,\n Self::CreatedDate,\n #[cfg(unix)]\n Self::FileInode,\n Self::FileType,\n Self::Unsorted,\n ]\n }\n\n fn to_possible_value(&self) -> Option<PossibleValue> {\n Some(match self {\n Self::Name(SortCase::AaBbCc) => PossibleValue::new(\"name\").alias(\"filename\"),\n Self::Name(SortCase::ABCabc) => PossibleValue::new(\"Name\").alias(\"Filename\"),\n Self::NameMixHidden(SortCase::AaBbCc) => PossibleValue::new(\".name\").alias(\".filename\"),\n Self::NameMixHidden(SortCase::ABCabc) => PossibleValue::new(\".Name\").alias(\".Filename\"),\n Self::Size => PossibleValue::new(\"size\"),\n Self::Extension(SortCase::AaBbCc) => PossibleValue::new(\"ext\").alias(\"extension\"),\n Self::Extension(SortCase::ABCabc) => PossibleValue::new(\"Ext\").alias(\"Extension\"),\n // \u201cnew\u201d sorts oldest at the top and newest at the bottom; \u201cold\u201d sorts newest at the\n // top and oldest at the bottom. I think this is the right way round to do this:\n // \u201csize\u201d puts the smallest at the top and the largest at the bottom, doesn\u2019t it?\n Self::ModifiedDate => {\n PossibleValue::new(\"date\").aliases(vec![\"time\", \"mod\", \"modified\", \"new\", \"newest\"])\n }\n // Similarly, \u201cage\u201d means that files with the least age (the newest files) get sorted\n // at the top, and files with the most age (the oldest) at the bottom.\n Self::ModifiedAge => PossibleValue::new(\"age\").aliases(vec![\"old\", \"oldest\"]),\n Self::ChangedDate => PossibleValue::new(\"changed\").alias(\"ch\"),\n Self::AccessedDate => PossibleValue::new(\"accessed\").alias(\"acc\"),\n Self::CreatedDate => PossibleValue::new(\"created\").alias(\"cr\"),\n #[cfg(unix)]\n Self::FileInode => PossibleValue::new(\"inode\"),\n Self::FileType => PossibleValue::new(\"type\"),\n Self::Unsorted => PossibleValue::new(\"none\"),\n })\n }\n}\n\n#[derive(Clone, Debug, PartialEq, Eq)]\npub enum TimeArgs {\n Modified,\n Changed,\n Accessed,\n Created,\n}\n\nimpl ValueEnum for TimeArgs {\n fn value_variants<'a>() -> &'a [Self] {\n &[Self::Modified, Self::Changed, Self::Accessed, Self::Created]\n }\n\n fn to_possible_value(&self) -> Option<clap::builder::PossibleValue> {\n Some(match self {\n Self::Modified => PossibleValue::new(\"modified\").alias(\"mod\"),\n Self::Changed => PossibleValue::new(\"changed\").alias(\"ch\"),\n Self::Accessed => PossibleValue::new(\"accessed\").alias(\"acc\"),\n Self::Created => PossibleValue::new(\"created\").alias(\"cr\"),\n })\n }\n}\n\n#[allow(unused)]\n#[derive(Debug, Clone)]\npub struct TimeFormatParser;\n\nimpl clap::builder::ValueParserFactory for TimeFormat {\n type Parser = TimeFormatParser;\n fn value_parser() -> Self::Parser {\n TimeFormatParser\n }\n}\n\nimpl clap::builder::TypedValueParser for TimeFormatParser {\n type Value = TimeFormat;\n\n fn parse_ref(\n &self,\n cmd: &clap::Command,\n _arg: Option<&clap::Arg>,\n value: &std::ffi::OsStr,\n ) -> Result<Self::Value, Error> {\n match TimeFormat::try_from_str(value.to_str().unwrap()) {\n Err(s) => Err(Error::raw(clap::error::ErrorKind::InvalidValue, s).with_cmd(cmd)),\n Ok(v) => Ok(v),\n }\n }\n}\n\nimpl ValueEnum for Absolute {\n fn value_variants<'a>() -> &'a [Self] {\n &[Self::On, Self::Off, Self::Follow]\n }\n\n fn to_possible_value(&self) -> Option<clap::builder::PossibleValue> {\n Some(match self {\n Self::On => PossibleValue::new(\"on\").alias(\"yes\"),\n Self::Off => PossibleValue::new(\"off\").alias(\"no\"),\n Self::Follow => PossibleValue::new(\"follow\"),\n })\n }\n}\n\n#[cfg(test)]\npub mod test {\n use super::*;\n\n pub fn mock_cli<I, T>(itr: I) -> clap::ArgMatches\n where\n I: IntoIterator<Item = T>,\n T: Into<OsString> + Clone,\n {\n get_command().no_binary_name(true).get_matches_from(itr)\n }\n\n pub fn mock_cli_try<I, T>(itr: I) -> Result<clap::ArgMatches, clap::error::Error>\n where\n I: IntoIterator<Item = T>,\n T: Into<OsString> + Clone,\n {\n get_command().no_binary_name(true).try_get_matches_from(itr)\n }\n\n #[test]\n fn deduce_files() {\n let cli = mock_cli(vec![\"file1\", \"file2\"]);\n assert_eq!(\n cli.get_many(\"FILE\")\n .unwrap()\n .map(OsString::as_os_str)\n .collect::<Vec<_>>(),\n [\"file1\", \"file2\"]\n );\n }\n}\n"}, {"path": "src/output/file_name.rs", "content": "// SPDX-FileCopyrightText: 2024 Christina S\u00f8rensen\n// SPDX-License-Identifier: EUPL-1.2\n//\n// SPDX-FileCopyrightText: 2023-2024 Christina S\u00f8rensen, eza contributors\n// SPDX-FileCopyrightText: 2014 Benjamin Sago\n// SPDX-License-Identifier: MIT\nuse std::fmt::Debug;\nuse std::path::Path;\n\nuse nu_ansi_term::{AnsiString as ANSIString, Style};\nuse path_clean;\nuse unicode_width::UnicodeWidthStr;\n\nuse crate::fs::{File, FileTarget};\nuse crate::output::cell::TextCellContents;\nuse crate::output::escape;\nuse crate::output::icons::{icon_for_file, iconify_style};\nuse crate::output::render::FiletypeColours;\nuse crate::theme::FileNameStyle;\n\n/// Basically a file name factory.\n#[derive(Debug, Copy, Clone, PartialEq)]\npub struct Options {\n /// Whether to append file class characters to file names.\n pub classify: Classify,\n\n /// Whether to prepend icon characters before file names.\n pub show_icons: ShowIcons,\n\n /// How to display file names with spaces (with or without quotes).\n pub quote_style: QuoteStyle,\n\n /// Whether to make file names hyperlinks.\n pub embed_hyperlinks: EmbedHyperlinks,\n\n /// Whether to display files with their absolute path.\n pub absolute: Absolute,\n\n /// Whether we are in a console or redirecting the output\n pub is_a_tty: bool,\n}\n\nimpl Options {\n /// Create a new `FileName` that prints the given file\u2019s name, painting it\n /// with the remaining arguments.\n pub fn for_file<'a, 'dir, C>(\n self,\n file: &'a File<'dir>,\n colours: &'a C,\n ) -> FileName<'a, 'dir, C> {\n FileName {\n file,\n colours,\n link_style: LinkStyle::JustFilenames,\n options: self,\n target: if file.is_link() {\n Some(file.link_target())\n } else {\n None\n },\n mount_style: MountStyle::JustDirectoryNames,\n }\n }\n}\n\n/// When displaying a file name, there needs to be some way to handle broken\n/// links, depending on how long the resulting Cell can be.\n#[derive(PartialEq, Debug, Copy, Clone)]\nenum LinkStyle {\n /// Just display the file names, but colour them differently if they\u2019re\n /// a broken link or can\u2019t be followed.\n JustFilenames,\n\n /// Display all files in their usual style, but follow each link with an\n /// arrow pointing to their path, colouring the path differently if it\u2019s\n /// a broken link, and doing nothing if it can\u2019t be followed.\n FullLinkPaths,\n}\n\n/// Whether to append file class characters to the file names.\n#[derive(PartialEq, Eq, Debug, Default, Copy, Clone)]\npub enum Classify {\n /// Just display the file names, without any characters.\n #[default]\n JustFilenames,\n\n /// Always add a character after the file name depending on what class of\n /// file it is.\n AddFileIndicators,\n\n // Like previous, but only when output is going to a terminal, not otherwise.\n AutomaticAddFileIndicators,\n}\n\n/// When displaying a directory name, there needs to be some way to handle\n/// mount details, depending on how long the resulting Cell can be.\n#[derive(PartialEq, Debug, Copy, Clone)]\nenum MountStyle {\n /// Just display the directory names.\n JustDirectoryNames,\n\n /// Display mount points as directories and include information about\n /// the filesystem that's mounted there.\n MountInfo,\n}\n\n/// Whether and how to show icons.\n#[derive(PartialEq, Debug, Copy, Clone)]\npub enum ShowIcons {\n /// Display icons next to file names, with the given number of spaces between\n /// the icon and the file name, even when output isn\u2019t going to a terminal.\n Always(u32),\n\n /// Same as Always, but only when output is going to a terminal, not otherwise.\n Automatic(u32),\n\n /// Never display them, even when output is going to a terminal.\n Never,\n}\n\n/// Whether to embed hyperlinks.\n#[derive(PartialEq, Eq, Debug, Copy, Clone)]\npub enum EmbedHyperlinks {\n /// Never embed hyperlinks, even when output is going to a terminal.\n Never,\n\n /// Embed hyperlinks automatically, based on the output destination.\n Automatic,\n\n /// Always embed hyperlinks, even when the output isn't going to a terminal.\n Always,\n}\n\n/// Whether to show absolute paths\n#[derive(PartialEq, Eq, Debug, Copy, Clone)]\npub enum Absolute {\n On,\n Follow,\n Off,\n}\n\n/// Whether or not to wrap file names with spaces in quotes.\n#[derive(PartialEq, Debug, Copy, Clone)]\npub enum QuoteStyle {\n /// Don't ever quote file names.\n NoQuotes,\n\n /// Use single quotes for file names that contain spaces and no single quotes\n /// Use double quotes for file names that contain single quotes.\n QuoteSpaces,\n}\n\n/// A **file name** holds all the information necessary to display the name\n/// of the given file. This is used in all of the views.\npub struct FileName<'a, 'dir, C> {\n /// A reference to the file that we\u2019re getting the name of.\n file: &'a File<'dir>,\n\n /// The colours used to paint the file name and its surrounding text.\n colours: &'a C,\n\n /// The file that this file points to if it\u2019s a link.\n target: Option<FileTarget<'dir>>, // todo: remove?\n\n /// How to handle displaying links.\n link_style: LinkStyle,\n\n pub options: Options,\n\n /// How to handle displaying a mounted filesystem.\n mount_style: MountStyle,\n}\n\nimpl<C> FileName<'_, '_, C> {\n /// Sets the flag on this file name to display link targets with an\n /// arrow followed by their path.\n #[must_use]\n pub fn with_link_paths(mut self) -> Self {\n if !self.file.deref_links {\n self.link_style = LinkStyle::FullLinkPaths;\n }\n self\n }\n\n /// Sets the flag on this file name to display mounted filesystem\n ///details.\n #[must_use]\n pub fn with_mount_details(mut self, enable: bool) -> Self {\n self.mount_style = if enable {\n MountStyle::MountInfo\n } else {\n MountStyle::JustDirectoryNames\n };\n self\n }\n}\n\nimpl<C: Colours> FileName<'_, '_, C> {\n /// Paints the name of the file using the colours, resulting in a vector\n /// of coloured cells that can be printed to the terminal.\n ///\n /// This method returns some `TextCellContents`, rather than a `TextCell`,\n /// because for the last cell in a table, it doesn\u2019t need to have its\n /// width calculated.\n #[must_use]\n pub fn paint(&self) -> TextCellContents {\n let mut bits = Vec::new();\n let (icon_override, filename_style_override) = match self.colours.style_override(self.file)\n {\n Some(FileNameStyle { icon, filename }) => (icon, filename),\n None => (None, None),\n };\n\n let spaces_count_opt = match self.options.show_icons {\n ShowIcons::Always(spaces_count) => Some(spaces_count),\n ShowIcons::Automatic(spaces_count) if self.options.is_a_tty => Some(spaces_count),\n _ => None,\n };\n\n let should_add_classify_char = match self.options.classify {\n Classify::AddFileIndicators => true,\n Classify::AutomaticAddFileIndicators if self.options.is_a_tty => true,\n _ => false,\n };\n\n if let Some(spaces_count) = spaces_count_opt {\n let (style, icon) = match icon_override {\n Some(icon_override) => (\n if let Some(style_override) = icon_override.style {\n style_override\n } else {\n iconify_style(self.style())\n },\n icon_override\n .glyph\n .unwrap_or_else(|| icon_for_file(self.file))\n .to_string(),\n ),\n None => (\n iconify_style(self.style()),\n icon_for_file(self.file).to_string(),\n ),\n };\n\n bits.push(style.paint(icon));\n bits.push(style.paint(\" \".repeat(spaces_count as usize)));\n }\n\n if self.file.parent_dir.is_none()\n && self.options.absolute == Absolute::Off\n && let Some(parent) = self.file.path.parent()\n {\n self.add_parent_bits(&mut bits, parent);\n }\n\n if !self.file.name.is_empty() {\n // The \u201cmissing file\u201d colour seems like it should be used here,\n // but it\u2019s not! In a grid view, where there\u2019s no space to display\n // link targets, the filename has to have a different style to\n // indicate this fact. But when showing targets, we can just\n // colour the path instead (see below), and leave the broken\n // link\u2019s filename as the link colour.\n for bit in self.escaped_file_name(filename_style_override) {\n bits.push(bit);\n }\n }\n\n if let (LinkStyle::FullLinkPaths, Some(target)) = (self.link_style, self.target.as_ref()) {\n match target {\n FileTarget::Ok(target) => {\n bits.push(Style::default().paint(\" \"));\n bits.push(self.colours.normal_arrow().paint(\"->\"));\n bits.push(Style::default().paint(\" \"));\n\n if let Some(parent) = target.path.parent() {\n self.add_parent_bits(&mut bits, parent);\n }\n\n if !target.name.is_empty() {\n let target_options = Options {\n classify: Classify::JustFilenames,\n quote_style: QuoteStyle::QuoteSpaces,\n show_icons: ShowIcons::Never,\n embed_hyperlinks: EmbedHyperlinks::Never,\n is_a_tty: self.options.is_a_tty,\n absolute: Absolute::Off,\n };\n\n let target_name = FileName {\n file: target,\n colours: self.colours,\n target: None,\n link_style: LinkStyle::FullLinkPaths,\n options: target_options,\n mount_style: MountStyle::JustDirectoryNames,\n };\n\n for bit in target_name.escaped_file_name(filename_style_override) {\n bits.push(bit);\n }\n\n if should_add_classify_char && let Some(class) = self.classify_char(target)\n {\n bits.push(Style::default().paint(class));\n }\n }\n }\n\n FileTarget::Broken(broken_path) => {\n bits.push(Style::default().paint(\" \"));\n bits.push(self.colours.broken_symlink().paint(\"->\"));\n bits.push(Style::default().paint(\" \"));\n\n escape(\n broken_path.display().to_string(),\n &mut bits,\n self.colours.broken_filename(),\n self.colours.broken_control_char(),\n self.options.quote_style,\n );\n }\n\n FileTarget::Err(_) => {\n // Do nothing \u2014 the error gets displayed on the next line\n }\n }\n } else if should_add_classify_char && let Some(class) = self.classify_char(self.file) {\n bits.push(Style::default().paint(class));\n }\n\n if self.mount_style == MountStyle::MountInfo\n && let Some(mount_details) = self.file.mount_point_info()\n {\n // This is a filesystem mounted on the directory, output its details\n bits.push(Style::default().paint(\" [\"));\n bits.push(Style::default().paint(mount_details.source.clone()));\n bits.push(Style::default().paint(\" (\"));\n bits.push(Style::default().paint(mount_details.fstype.clone()));\n bits.push(Style::default().paint(\")]\"));\n }\n\n bits.into()\n }\n\n /// Adds the bits of the parent path to the given bits vector.\n /// The path gets its characters escaped based on the colours.\n fn add_parent_bits(&self, bits: &mut Vec<ANSIString<'_>>, parent: &Path) {\n let coconut = parent.components().count();\n\n if coconut == 1 && parent.has_root() {\n bits.push(\n self.colours\n .symlink_path()\n .paint(std::path::MAIN_SEPARATOR.to_string()),\n );\n } else if coconut >= 1 {\n escape(\n parent.to_string_lossy().to_string(),\n bits,\n self.colours.symlink_path(),\n self.colours.control_char(),\n self.options.quote_style,\n );\n bits.push(\n self.colours\n .symlink_path()\n .paint(std::path::MAIN_SEPARATOR.to_string()),\n );\n }\n }\n\n /// The character to be displayed after a file when classifying is on, if\n /// the file\u2019s type has one associated with it.\n #[cfg(unix)]\n pub(crate) fn classify_char(&self, file: &File<'_>) -> Option<&'static str> {\n if file.is_executable_file() {\n Some(\"*\")\n } else if file.is_directory() {\n Some(\"/\")\n } else if file.is_pipe() {\n Some(\"|\")\n } else if file.is_link() {\n Some(\"@\")\n } else if file.is_socket() {\n Some(\"=\")\n } else {\n None\n }\n }\n\n #[cfg(windows)]\n pub(crate) fn classify_char(&self, file: &File<'_>) -> Option<&'static str> {\n if file.is_directory() {\n Some(\"/\")\n } else if file.is_link() {\n Some(\"@\")\n } else {\n None\n }\n }\n\n /// Returns at least one ANSI-highlighted string representing this file\u2019s\n /// name using the given set of colours.\n ///\n /// If --hyperlink flag is provided, it will escape the filename accordingly.\n ///\n /// Ordinarily, this will be just one string: the file\u2019s complete name,\n /// coloured according to its file type. If the name contains control\n /// characters such as newlines or escapes, though, we can\u2019t just print them\n /// to the screen directly, because then there\u2019ll be newlines in weird places.\n ///\n /// So in that situation, those characters will be escaped and highlighted in\n /// a different colour.\n fn escaped_file_name<'unused>(\n &self,\n style_override: Option<Style>,\n ) -> Vec<ANSIString<'unused>> {\n let file_style = style_override.unwrap_or(self.style());\n let mut bits = Vec::new();\n\n let mut display_hyperlink = false;\n let should_embed_hyperlinks = match self.options.embed_hyperlinks {\n EmbedHyperlinks::Never => false,\n EmbedHyperlinks::Automatic => self.options.is_a_tty,\n EmbedHyperlinks::Always => true,\n };\n if should_embed_hyperlinks\n && let Some(abs_path) = self\n .file\n .absolute_path()\n .and_then(|p| p.as_os_str().to_str())\n {\n bits.push(ANSIString::from(escape::get_hyperlink_start_tag(abs_path)));\n\n display_hyperlink = true;\n }\n\n escape(\n self.display_name(),\n &mut bits,\n file_style,\n self.colours.control_char(),\n self.options.quote_style,\n );\n\n if display_hyperlink {\n bits.push(ANSIString::from(escape::HYPERLINK_CLOSING));\n }\n\n bits\n }\n\n /// Returns the string that should be displayed as the file's name.\n fn display_name(&self) -> String {\n match self.options.absolute {\n Absolute::On => std::env::current_dir().ok().and_then(|p| {\n path_clean::clean(p.join(&self.file.path))\n .to_str()\n .map(std::borrow::ToOwned::to_owned)\n }),\n Absolute::Follow => self\n .file\n .absolute_path()\n .and_then(|p| p.to_str())\n .map(std::borrow::ToOwned::to_owned),\n Absolute::Off => None,\n }\n .unwrap_or(self.file.name.clone())\n }\n\n /// Figures out which colour to paint the filename part of the output,\n /// depending on which \u201ctype\u201d of file it appears to be \u2014 either from the\n /// class on the filesystem or from its name. (Or the broken link colour,\n /// if there\u2019s nowhere else for that fact to be shown.)\n #[must_use]\n pub fn style(&self) -> Style {\n if let LinkStyle::JustFilenames = self.link_style\n && let Some(ref target) = self.target\n && target.is_broken()\n {\n return self.colours.broken_symlink();\n }\n\n #[rustfmt::skip]\n return match self.file {\n f if f.is_mount_point() => self.colours.mount_point(),\n f if f.is_directory() => self.colours.directory(),\n #[cfg(unix)]\n f if f.is_executable_file() => self.colours.executable_file(),\n f if f.is_link() => self.colours.symlink(),\n #[cfg(unix)]\n f if f.is_pipe() => self.colours.pipe(),\n #[cfg(unix)]\n f if f.is_block_device() => self.colours.block_device(),\n #[cfg(unix)]\n f if f.is_char_device() => self.colours.char_device(),\n #[cfg(unix)]\n f if f.is_socket() => self.colours.socket(),\n f if ! f.is_file() => self.colours.special(),\n _ => self.colours.colour_file(self.file),\n };\n }\n\n /// For grid's use, to cover the case of hyperlink escape sequences\n #[must_use]\n pub fn bare_utf8_width(&self) -> usize {\n UnicodeWidthStr::width(self.file.name.as_str())\n }\n}\n\n/// The set of colours that are needed to paint a file name.\npub trait Colours: FiletypeColours {\n /// The style to paint the path of a symlink\u2019s target, up to but not\n /// including the file\u2019s name.\n fn symlink_path(&self) -> Style;\n\n /// The style to paint the arrow between a link and its target.\n fn normal_arrow(&self) -> Style;\n\n /// The style to paint the filenames of broken links in views that don\u2019t\n /// show link targets, and the style to paint the *arrow* between the link\n /// and its target in views that *do* show link targets.\n fn broken_symlink(&self) -> Style;\n\n /// The style to paint the entire filename of a broken link.\n fn broken_filename(&self) -> Style;\n\n /// The style to paint a non-displayable control character in a filename.\n fn control_char(&self) -> Style;\n\n /// The style to paint a non-displayable control character in a filename,\n /// when the filename is being displayed as a broken link target.\n fn broken_control_char(&self) -> Style;\n\n /// The style to paint a file that has its executable bit set.\n fn executable_file(&self) -> Style;\n\n /// The style to paint a directory that has a filesystem mounted on it.\n fn mount_point(&self) -> Style;\n\n fn colour_file(&self, file: &File<'_>) -> Style;\n\n fn style_override(&self, file: &File<'_>) -> Option<FileNameStyle>;\n}\n"}, {"path": "build.rs", "content": "// SPDX-FileCopyrightText: 2024 Christina S\u00f8rensen\n// SPDX-License-Identifier: EUPL-1.2\n//\n// SPDX-FileCopyrightText: 2023-2024 Christina S\u00f8rensen, eza contributors\n// SPDX-FileCopyrightText: 2014 Benjamin Sago\n// SPDX-License-Identifier: MIT\n/// The version string isn\u2019t the simplest: we want to show the version,\n/// current Git hash, and compilation date when building *debug* versions, but\n/// just the version for *release* versions so the builds are reproducible.\n///\n/// This script generates the string from the environment variables that Cargo\n/// adds (<http://doc.crates.io/environment-variables.html>) and runs `git` to\n/// get the SHA1 hash. It then writes the string into a file, which exa then\n/// includes at build-time.\n///\n/// - <https://stackoverflow.com/q/43753491/3484614>\n/// - <https://crates.io/crates/vergen>\nuse std::env;\nuse std::fs::File;\nuse std::io::{self, Write};\nuse std::path::PathBuf;\n\nuse chrono::prelude::*;\n\n/// The build script entry point.\nfn main() -> io::Result<()> {\n #![allow(clippy::write_with_newline)]\n\n let tagline = \"eza - A modern, maintained replacement for ls\";\n let url = \"https://github.com/eza-community/eza\";\n\n let ver = if is_debug_build() {\n format!(\n \"{}\\nv{} \\\\1;31m(pre-release debug build!)\\\\0m\\n\\\\1;4;34m{}\\\\0m\",\n tagline,\n version_string(),\n url\n )\n } else if is_development_version() {\n format!(\n \"{}\\nv{} [{}] built on {} \\\\1;31m(pre-release!)\\\\0m\\n\\\\1;4;34m{}\\\\0m\",\n tagline,\n version_string(),\n git_hash(),\n build_date(),\n url\n )\n } else {\n format!(\"{}\\nv{}\\n\\\\1;4;34m{}\\\\0m\", tagline, version_string(), url)\n };\n\n // We need to create these files in the Cargo output directory.\n let out = PathBuf::from(env::var(\"OUT_DIR\").unwrap());\n let path = &out.join(\"version_string.txt\");\n\n // Bland version text\n let mut f =\n File::create(path).unwrap_or_else(|_| panic!(\"{}\", path.to_string_lossy().to_string()));\n writeln!(f, \"{}\", strip_codes(&ver))?;\n\n Ok(())\n}\n\n/// Removes escape codes from a string.\nfn strip_codes(input: &str) -> String {\n input\n .replace(\"\\\\0m\", \"\")\n .replace(\"\\\\1;31m\", \"\")\n .replace(\"\\\\1;4;34m\", \"\")\n}\n\n/// Retrieve the project\u2019s current Git hash, as a string.\nfn git_hash() -> String {\n use std::process::Command;\n\n String::from_utf8_lossy(\n &Command::new(\"git\")\n .args([\"rev-parse\", \"--short\", \"HEAD\"])\n .output()\n .unwrap()\n .stdout,\n )\n .trim()\n .to_string()\n}\n\n/// Whether we should show pre-release info in the version string.\n///\n/// Both weekly releases and actual releases are --release releases,\n/// but actual releases will have a proper version number.\nfn is_development_version() -> bool {\n cargo_version().ends_with(\"-pre\") || env::var(\"PROFILE\").unwrap() == \"debug\"\n}\n\n/// Whether we are building in debug mode.\nfn is_debug_build() -> bool {\n env::var(\"PROFILE\").unwrap() == \"debug\"\n}\n\n/// Retrieves the [package] version in Cargo.toml as a string.\nfn cargo_version() -> String {\n env::var(\"CARGO_PKG_VERSION\").unwrap()\n}\n\n/// Returns the version and build parameters string.\nfn version_string() -> String {\n let mut ver = cargo_version();\n\n let feats = nonstandard_features_string();\n if !feats.is_empty() {\n ver.push_str(&format!(\" [{}]\", &feats));\n }\n\n ver\n}\n\n/// Finds whether a feature is enabled by examining the Cargo variable.\nfn feature_enabled(name: &str) -> bool {\n env::var(format!(\"CARGO_FEATURE_{name}\"))\n .map(|e| !e.is_empty())\n .unwrap_or(false)\n}\n\n/// A comma-separated list of non-standard feature choices.\nfn nonstandard_features_string() -> String {\n let mut s = Vec::new();\n\n if feature_enabled(\"GIT\") {\n s.push(\"+git\");\n } else {\n s.push(\"-git\");\n }\n\n s.join(\", \")\n}\n\n/// Formats the current date as an ISO 8601 string.\nfn build_date() -> String {\n let now = Local::now();\n now.date_naive().format(\"%Y-%m-%d\").to_string()\n}\n"}, {"path": "src/options/dir_action.rs", "content": "// SPDX-FileCopyrightText: 2024 Christina S\u00f8rensen\n// SPDX-License-Identifier: EUPL-1.2\n//\n// SPDX-FileCopyrightText: 2023-2024 Christina S\u00f8rensen, eza contributors\n// SPDX-FileCopyrightText: 2014 Benjamin Sago\n// SPDX-License-Identifier: MIT\n//! Parsing the options for `DirAction`.\n\nuse crate::options::OptionsError;\n\nuse crate::fs::dir_action::{DirAction, RecurseOptions};\n\nuse clap::ArgMatches;\n\nimpl DirAction {\n /// Determine which action to perform when trying to list a directory.\n /// There are three possible actions, and they overlap somewhat: the\n /// `--tree` flag is another form of recursion, so those two are allowed\n /// to both be present, but the `--treat-dirs-as-files` flag is used\n /// separately.\n pub fn deduce(\n matches: &ArgMatches,\n can_tree: bool,\n strict: bool,\n ) -> Result<Self, OptionsError> {\n let recurse = matches.get_flag(\"recurse\");\n let as_file = matches.get_flag(\"treat-dirs-as-files\");\n let tree = matches.get_flag(\"tree\");\n\n if strict {\n // Early check for --level when it wouldn\u2019t do anything\n if !recurse && !tree && matches.get_one::<usize>(\"level\").is_some() {\n return Err(OptionsError::Useless2(\"level\", \"recurse\", \"tree\"));\n } else if recurse && as_file {\n return Err(OptionsError::Conflict(\"recurse\", \"treat-dirs-as-files\"));\n } else if tree && as_file {\n return Err(OptionsError::Conflict(\"tree\", \"treat-dirs-as-files\"));\n }\n }\n\n if tree && can_tree {\n // Tree is only appropriate in details mode, so this has to\n // examine the View, which should have already been deduced by now\n Ok(Self::Recurse(RecurseOptions::deduce(matches, true)))\n } else if recurse {\n Ok(Self::Recurse(RecurseOptions::deduce(matches, false)))\n } else if as_file {\n Ok(Self::AsFile)\n } else {\n Ok(Self::List)\n }\n }\n}\n\nimpl RecurseOptions {\n /// Determine which files should be recursed into, based on the `--level`\n /// flag\u2019s value, and whether the `--tree` flag was passed, which was\n /// determined earlier. The maximum level should be a number, and this\n /// will fail with an `Err` if it isn\u2019t.\n pub fn deduce(matches: &ArgMatches, tree: bool) -> Self {\n Self {\n tree,\n max_depth: matches.get_one(\"level\").copied(),\n }\n }\n}\n\n#[cfg(test)]\nmod tests {\n use super::*;\n use crate::options::parser::test::{mock_cli, mock_cli_try};\n\n #[test]\n fn deduce_dir_action_list() {\n assert_eq!(\n DirAction::deduce(&mock_cli(vec![\"\"]), false, false),\n Ok(DirAction::List)\n );\n }\n\n #[test]\n fn deduce_recurse_options_level() {\n assert_eq!(\n RecurseOptions::deduce(&mock_cli(vec![\"--level\", \"3\"]), false),\n RecurseOptions {\n tree: false,\n max_depth: Some(3),\n }\n );\n }\n\n #[test]\n fn deduce_recurse_options_no_level() {\n assert_eq!(\n DirAction::deduce(&mock_cli(vec![\"--recurse\"]), true, true),\n Ok(DirAction::Recurse(RecurseOptions {\n tree: false,\n max_depth: None,\n }))\n );\n }\n\n #[test]\n fn deduce_dir_action_as_file() {\n assert_eq!(\n DirAction::deduce(&mock_cli(vec![\"--treat-dirs-as-files\"]), false, false),\n Ok(DirAction::AsFile)\n );\n }\n\n #[test]\n fn deduce_dir_action_recurse() {\n assert_eq!(\n DirAction::deduce(&mock_cli(vec![\"--recurse\"]), false, false),\n Ok(DirAction::Recurse(RecurseOptions {\n tree: false,\n max_depth: None,\n }))\n );\n }\n\n #[test]\n fn deduce_dir_action_tree() {\n assert_eq!(\n DirAction::deduce(&mock_cli(vec![\"--tree\"]), true, false),\n Ok(DirAction::Recurse(RecurseOptions {\n tree: true,\n max_depth: None,\n }))\n );\n }\n\n #[test]\n fn deduce_dir_action_tree_level() {\n assert_eq!(\n DirAction::deduce(&mock_cli(vec![\"--tree\", \"--level\", \"3\"]), true, false),\n Ok(DirAction::Recurse(RecurseOptions {\n tree: true,\n max_depth: Some(3),\n }))\n );\n }\n\n #[test]\n fn deduce_dir_action_tree_level_conflict() {\n assert_eq!(\n DirAction::deduce(&mock_cli(vec![\"--level\", \"3\"]), false, true),\n Err(OptionsError::Useless2(\"level\", \"recurse\", \"tree\"))\n );\n }\n\n #[test]\n fn deduce_dir_action_recurse_as_file_conflict() {\n assert!(mock_cli_try(vec![\"--recurse\", \"--treat-dirs-as-files\"]).is_err());\n }\n\n #[test]\n fn deduce_dir_action_tree_as_file_conflict() {\n assert!(mock_cli_try(vec![\"--tree\", \"--treat-dirs-as-files\"]).is_err());\n }\n}\n"}], "context_lines": 1479, "buggy_files": ["README.md", "completions/bash/eza", "completions/fish/eza.fish", "completions/nush/eza.nu", "completions/pwsh/_eza.ps1", "completions/zsh/_eza", "man/eza.1.md", "src/options/file_name.rs", "src/options/parser.rs", "src/output/file_name.rs"], "test_files": [{"path": "powertest.yaml", "content": "# SPDX-FileCopyrightText: 2024 Christina S\u00f8rensen\n# SPDX-License-Identifier: EUPL-1.2\ndump_dir: tests/ptests\ndepth: 1\nbinary: eza\ngen_binary: target/debug/eza\nargs: tests/test_dir\ncommands:\n ? - null # Meta options\n - --help\n :\n ? - -v\n - --version\n :\n ? - -1 # Display Options\n - --oneline\n :\n ? - -l\n - --long\n :\n ? - -G\n - --grid\n :\n ? - -x\n - --across\n :\n ? - -R\n - --recurse\n :\n ? - -T\n - --tree\n :\n ? - -X\n - --dereference\n :\n ? - -F\n - --classify\n :\n ? - -F\n - --classify\n : values:\n - auto\n - always\n - never\n ? - null\n - --color\n : values:\n - auto\n - always\n - never\n ? - null\n - --colour\n : values:\n - auto\n - always\n - never\n ? - null\n - --icons\n :\n ? - null\n - --icons\n : values:\n - auto\n - always\n - never\n ? - null\n - --no-quotes\n :\n ? - null\n - --hyperlink\n :\n ? - null\n - --hyperlink\n : values:\n - auto\n - always\n - never\n ? - null\n - --absolute\n : values:\n - on\n - follow\n - off\n ? - -w\n - --width\n : values:\n - 15\n - 30\n - 200\n ? - null\n - --smart-group\n :\n ? - -a # Filtering and Sorting Options\n - --all\n :\n ? - -A\n - --almost-all\n :\n ? - -d\n - --treat-dirs-as-files\n :\n ? - null\n - --treat-dirs-as-files\n :\n ? - -L # Hidden alias\n - --level\n : prefix: -T\n values:\n - 0\n - 1\n - 2\n - 3\n - 4\n - 5\n ? - -r\n - --reverse\n :\n ? - -s\n - --sort\n : short: -s\n long: time-style\n prefix: -l\n values: # non-deterministic results with our setup (tests/test_dir) are commented out \n # - accessed\n # - age\n # - changed\n # - created\n # - date\n - Ext\n - ext\n - Extension\n - extension\n - Filename\n - filename\n # - inode\n # - modified\n - Name\n - name\n # - newest\n # - none\n # - oldest\n # - size\n # - time\n - type\n ? - null\n - --group-directories-first\n :\n ? - null\n - --group-directories-last\n :\n ? - -D\n - --only-dirs\n :\n ? - -f\n - --only-files\n :\n ? - -f\n - --only-files\n :\n ? - -I # TODO: add more globs\n - --ignore-glob\n : prefix: -l\n values:\n - \"*.toml\"\n ? - null\n - --git-ignore\n :\n ? - -b # Long View Options\n - --binary\n :\n ? - -B\n - --bytes\n :\n ? - -g\n - --group\n :\n ? - -h\n - --header\n :\n ? - -H\n - --links\n :\n ? - -i\n - --inode\n :\n ? - -m\n - --modified\n :\n ? - -M\n - --mounts\n :\n ? - -n\n - --numeric\n :\n ? - -S\n - --blocksize\n :\n ? - -t\n - --time\n : prefix: -l\n values:\n - modified\n #- accessed BROKEN\n #- changed\n #- created\n ? - -u\n - --accessed\n :\n ? - -U\n - --created\n :\n ? - null\n - --changed\n :\n ? - null\n - --time-style\n : long: time-style\n values:\n - default\n - iso\n - long-iso\n - full-iso\n - relative\n ? - null\n - --total-size\n :\n ? - null\n - --no-permissions\n :\n ? - -o\n - --octal-permissions\n :\n ? - null\n - --no-filesize\n :\n ? - null\n - --no-user\n :\n ? - null\n - --git\n :\n ? - null\n - --no-git\n :\n ? - null\n - --git-repos\n :\n ? - -@\n - --extended\n :\n ? - -Z\n - --context\n :\n"}, {"path": "tests/ptests/ptest_2439b7d68089135b.stdout", "content": "A modern replacement for ls\n\nUsage: eza [OPTIONS] [FILE]...\n\nMETA OPTIONS:\n --stdin read file names from stdin\n -?, --help Print help\n -v, --version Print help\n\nLAYOUT OPTIONS:\n -1, --oneline display one entry per line\n -l, --long display extended file metadata as a table\n -G, --grid display entries as a grid (default)\n -x, --across sort the grid across, rather than downwards\n -R, --recurse recurse into directories\n -T, --tree recurse into directories as a tree\n -L, --level <DEPTH> limit the depth of recursion\n --follow-symlinks drill down into symbolic links that point to directories\n -w, --width <COLS> set screen width in columns\n\nDISPLAY OPTIONS:\n -F, --classify [<WHEN>] display type indicator by file names [possible values: always, auto, never]\n -X, --dereference dereference symbolic links when displaying information\n --absolute [<absolute>] display entries with their absolute path [possible values: on, off, follow]\n --color [<WHEN>] When to use colours. [default: auto] [possible values: always, auto, never]\n --color-scale [<FIELDS>...] highlight value of FIELDS distinctly [possible values: all, age, size]\n --color-scale-mode <MODE> mode for --color-scale [default: gradient] [possible values: fixed, gradient]\n --icons [<WHEN>] when to display icons [possible values: always, auto, never]\n --hyperlink [<WHEN>] when to display entries as hyperlinks [possible values: always, auto, never]\n --no-quotes don't quote file names with spaces\n\nFILTERING OPTIONS:\n -a, --all... show hidden files. Use this twice to also show the '.' and '..' directories\n -A, --almost-all equivalent to --all; included for compatibility with `ls -A`\n -d, --treat-dirs-as-files treat directories as files; don't list their contents\n -D, --only-dirs list only directories\n -f, --only-files list only files\n --show-symlinks explicitly show symbolic links (with --only-dirs and --only-files)\n --no-symlinks do not show symbolic links\n -I, --ignore-glob <GLOBS> glob patterns (pipe-separated) of files to ignore\n --git-ignore ignore files mentioned in '.gitignore'\n\nSORTING OPTIONS:\n --group-directories-first list directories before other files\n --group-directories-last list directories after other files\n -s, --sort <FIELD> which field to sort by [default: name] [possible values:\n name, Name, .name, .Name, ext, ext, created,\n date, age, accessed, changed,\n size, inode, type, none]\n -r, --reverse reverse the sort order\n\nLONG VIEW OPTIONS:\n -h, --header add a header row to each column\n -i, --inode list each file's inode number\n -o, --octal-permissions list each file's permission in octal format\n -H, --links list each file's number of hard links\n -b, --binary show file sizes with binary prefixes\n -B, --bytes show file sizes in bytes, without any prefixes\n --total-size show the size of a directory as the one of its content (unix only)\n -S, --blocksize list size of allocated file system blocks\n -g, --group list each file's group\n --smart-group only show group if it has a different name from owner\n -n, --numeric show user and group as their numeric IDs\n -t, --time <FIELD> which timestamp field to show [possible values:\n mod|modified, acc|accessed, ch|changed, cr|created]\n -m, --modified show the modified timestamp field (replace default field, combinable)\n -u, --accessed show the accessed timestamp field (replace default field, combinable)\n --changed show the changed timestamp field (replace default field, combinable)\n -U, --created show the created timestamp field (replace default field, combinable)\n --time-style <STYLE> how to format timestamps [possible values:\n default, iso, long-iso, full-iso, relative, \"+<CUSTOM_FORMAT>\"]\n -O, --flags list file flags (Mac, BSD, and Windows only)\n -Z, --context list each file's security context\n --git list each file's Git status, if tracked or ignored\n --git-repos list root of git-tree status\n --git-repos-no-status list each git-repos branch name (much faster)\n -M, --mounts show mount details (Linux and macOS only)\n -@, --extended list each file's extended attributes and sizes\n --no-permissions suppress the permissions field\n --no-filesize suppress the filesize field\n --no-user suppress the user field\n --no-time suppress the time field\n --no-git suppress Git fields (overrides --git, --git-repos, --git-repos-no-status)\n"}, {"path": "tests/ptests/ptest_295b1dd87a9bb792.toml", "content": "bin.name = \"eza\"\nargs = \"tests/test_dir --hyperlink never\""}, {"path": "tests/ptests/ptest_bba388583551f506.toml", "content": "bin.name = \"eza\"\nargs = \"tests/test_dir --hyperlink always\""}, {"path": "tests/ptests/ptest_e8471ce10a208fd.toml", "content": "bin.name = \"eza\"\nargs = \"tests/test_dir --hyperlink auto\""}], "eval": {"test_cmds": ["cd /tmp/cache/repos/eza-community__eza && mkdir -p reports && cargo test --workspace -v 2>&1 | tee reports/test-output.log"], "print_cmds": [], "log_parser": "def parser(log: str) -> dict[str, str]:\n import re\n\n def strip_ansi(s: str) -> str:\n # Remove ANSI CSI/OSC/other escape sequences\n ansi = re.compile(\n r\"(?:\\x1B[@-Z\\\\-_]|\\x1B\\[[0-?]*[ -/]*[@-~]|\\x1B\\][^\\x07]*(?:\\x07|\\x1B\\\\))\"\n )\n return ansi.sub(\"\", s)\n\n def norm_status(raw: str) -> str | None:\n rl = raw.strip().lower()\n if rl in {\"ok\", \"pass\", \"passed\", \"success\"}:\n return \"pass\"\n if rl in {\"ignored\", \"skipped\", \"skip\", \"filtered out\", \"xfail\", \"xfailed\"}:\n return \"skip\"\n if rl in {\"failed\", \"fail\", \"failure\", \"error\", \"errored\"}:\n return \"fail\"\n if rl in {\"measured\", \"bench\"}:\n return \"pass\"\n return None\n\n results: dict[str, str] = {}\n pending: set[str] = set()\n\n # Rust libtest\n libtest_done = re.compile(\n r\"^\\s*test\\s+(?P<name>.+?)\\s+\\.\\.\\.\\s+(?P<status>ok|FAILED|ignored|measured|bench|filtered out)\\s*$\"\n )\n libtest_start = re.compile(r\"^\\s*test\\s+(?P<name>.+?)\\s+\\.\\.\\.\\s*$\")\n\n # trycmd (common)\n trycmd = re.compile(\n r\"^\\s*(?:Testing|Test)\\s+(?P<name>.+?)\\s+\\.\\.\\.\\s+(?P<status>ok|FAILED|ignored|skipped)\\b\"\n )\n\n # pytest\n pytest = re.compile(\n r\"^\\s*(?P<name>\\S+::\\S+)\\s+(?P<status>PASSED|FAILED|SKIPPED|XFAIL|XPASS|ERROR)\\b\"\n )\n\n # Go test\n gotest = re.compile(r\"^\\s*---\\s+(?P<status>PASS|FAIL|SKIP):\\s+(?P<name>\\S+)\\b\")\n\n # unittest\n unittest = re.compile(\n r\"^\\s*(?P<name>test\\w+\\s+\\([^)]+\\))\\s+\\.\\.\\.\\s+(?P<status>ok|FAIL|ERROR|skipped)\\b\"\n )\n\n for raw_line in log.splitlines():\n s = strip_ansi(raw_line).strip()\n if not s:\n continue\n\n m = libtest_done.match(s)\n if m:\n name = m.group(\"name\").strip()\n results[name] = norm_status(m.group(\"status\")) or \"fail\"\n pending.discard(name)\n continue\n\n m = trycmd.match(s)\n if m:\n name = m.group(\"name\").strip()\n results[name] = norm_status(m.group(\"status\")) or \"fail\"\n continue\n\n m = pytest.match(s)\n if m:\n name = m.group(\"name\").strip()\n results[name] = norm_status(m.group(\"status\")) or \"fail\"\n continue\n\n m = gotest.match(s)\n if m:\n name = m.group(\"name\").strip()\n results[name] = norm_status(m.group(\"status\")) or \"fail\"\n continue\n\n m = unittest.match(s)\n if m:\n name = m.group(\"name\").strip()\n results[name] = norm_status(m.group(\"status\")) or \"fail\"\n continue\n\n m = libtest_start.match(s)\n if m:\n name = m.group(\"name\").strip()\n if name not in results:\n pending.add(name)\n continue\n\n # Incomplete tests (seen start, no completion)\n for name in pending:\n results.setdefault(name, \"fail\")\n\n return results", "rebuild_cmds": []}}
{"id": "patchbench-rust-real-0062", "repo": "gleam-lang/gleam", "base_commit": "56c224a84420e1d3b4cf30e934c684128f5f8d7b", "status": "f2p_not_passing_postfix", "verify_status": null, "error": null, "timing": {"setup": 0.9, "pre_test_0": 113.9, "pre_test_1": 3.1, "post_test_0": 131.6, "post_test_1": 19.7, "total": 269.6}, "test_cmds": ["cd /tmp/cache/repos/gleam-lang__gleam && mkdir -p reports && cargo test --workspace --all-features -- --nocapture 2>&1 | tee reports/test-output.log"], "rebuild_cmds": [], "print_cmds": [], "f2p_pre_ok": true, "pre_detail": {"missing": 0, "wrong": [], "missing_ids": [], "parsed_count": 3757}, "p2p_env_dropped_count": 3750, "f2p_post_ok": false, "p2p_post_ok": true, "post_detail": {"missing": 1558, "wrong": [], "missing_ids": ["target/debug/deps/test_package_compiler-29695dcf5746d6e1::generated_tests::duplicate_module", "target/debug/deps/gleam_language_server-8b82b3133757a90f::tests::action::add_missing_patterns_multi", "target/debug/deps/gleam_language_server-8b82b3133757a90f::tests::signature_help::help_shows_documentation_for_imported_function", "target/debug/deps/gleam_language_server-8b82b3133757a90f::tests::completion::imported_type", "target/debug/deps/gleam_language_server-8b82b3133757a90f::tests::action::generate_variant_with_no_fields_in_same_module"], "parsed_count": 5266}, "raw_tail": "ts::warnings::used_private_const_warnings_test2 ... ok\ntest type_::tests::warnings::used_private_fn_warnings_test ... ok\ntest type_::tests::warnings::used_private_fn_warnings_test2 ... ok\ntest type_::tests::warnings::used_variable_shadowing_test ... ok\ntest type_::tests::warnings::used_type_with_import_alias_no_warning_test ... ok\ntest type_::tests::warnings::used_variable_warnings_test ... ok\ntest type_::tests::warnings::used_variable_warnings_test2 ... ok\ntest type_::tests::warnings::variables_not_redundant_comparison ... ok\ntest type_::tests::warnings::variables_redundant_comparison ... ok\ntest type_::tests::warnings::warning_many_at_same_time ... ok\ntest type_::tests::warnings::warning_private_function_never_used ... ok\ntest type_::tests::warnings::warning_variable_never_used_test ... ok\ntest type_::tests::warnings::warnings_for_matches_on_literal_values_that_are_not_like_an_if_1 ... ok\ntest uid::id_geneation ... ok\ntest type_::tests::warnings::warnings_for_matches_on_literal_values_that_are_not_like_an_if_2 ... ok\n\nfailures:\n\nfailures:\n type_::tests::const_record_update_unlabelled_fields\n type_::tests::const_record_update_variant_without_args\n type_::tests::errors::const_record_update_with_constructor_with_no_labelled_fields\n type_::tests::errors::record_update_with_constructor_with_no_labelled_fields\n\ntest result: FAILED. 3670 passed; 4 failed; 0 ignored; 0 measured; 0 filtered out; finished in 2.44s\n\nerror: test failed, to rerun pass `-p gleam-core --lib`\n\n"}
{"id": "patchbench-rust-real-0057", "repo": "Automattic/harper", "base_commit": "2e0ab60381f833d0c48536471dcdef4c8f1028ae", "status": "f2p_not_failing_prefix", "verify_status": null, "error": null, "timing": {"setup": 3.5, "pre_test_0": 439.0, "pre_test_1": 50.0, "post_test_0": 361.4, "post_test_1": 49.1, "total": 906.9}, "test_cmds": ["cd /tmp/cache/repos/Automattic__harper && mkdir -p reports && RUSTUP_TOOLCHAIN=stable cargo test -p harper-core --locked -- --nocapture 2>&1 | tee reports/test-output.log"], "rebuild_cmds": [], "print_cmds": [], "f2p_pre_ok": false, "pre_detail": {"missing": 0, "wrong": [["linting::need_to_noun::tests::flags_needs_to_verification", "pass"]], "missing_ids": [], "parsed_count": 5213}, "p2p_env_dropped_count": 6, "f2p_post_ok": true, "p2p_post_ok": false, "post_detail": {"missing": 0, "wrong": [], "missing_ids": [], "parsed_count": 5211}, "raw_tail": "ll/fst_dictionary.rs:316:13] &misspelled_lower = \"desynchronise\"\n[harper-core/src/spell/fst_dictionary.rs:316:13] &misspelled_lower = \"cowrie\"\n[harper-core/src/spell/fst_dictionary.rs:316:13] &misspelled_lower = \"guaranteeing\"\n[harper-core/src/spell/fst_dictionary.rs:316:13] &misspelled_lower = \"doubly\"\n[harper-core/src/spell/fst_dictionary.rs:316:13] &misspelled_lower = \"mulch\"\n[harper-core/src/spell/fst_dictionary.rs:316:13] &misspelled_lower = \"brassiere\"\n[harper-core/src/spell/fst_dictionary.rs:316:13] &misspelled_lower = \"infatuations\"\n[harper-core/src/spell/fst_dictionary.rs:316:13] &misspelled_lower = \"genteelness's\"\n[harper-core/src/spell/fst_dictionary.rs:316:13] &misspelled_lower = \"anterooms\"\n[harper-core/src/spell/fst_dictionary.rs:316:13] &misspelled_lower = \"franglais's\"\n[harper-core/src/spell/fst_dictionary.rs:316:13] &misspelled_lower = \"falsehood's\"\n[harper-core/src/spell/fst_dictionary.rs:316:13] &misspelled_lower = \"unreadable\"\n[harper-core/src/spell/fst_dictionary.rs:316:13] &misspelled_lower = \"lenient\"\n[harper-core/src/spell/fst_dictionary.rs:316:13] &misspelled_lower = \"shelby\"\n[harper-core/src/spell/fst_dictionary.rs:316:13] &misspelled_lower = \"presser's\"\n[harper-core/src/spell/fst_dictionary.rs:316:13] &misspelled_lower = \"ultimately\"\n[harper-core/src/spell/fst_dictionary.rs:316:13] &misspelled_lower = \"bell's\"\n[harper-core/src/spell/fst_dictionary.rs:316:13] &misspelled_lower = \"kafka's\"\n[harper-core/src/spell/fst_dictionary.rs:316:13] &misspelled_\n"}
{"id": "patchbench-rust-real-0035", "repo": "noir-lang/noir", "base_commit": "80b04ec8eab3ca74fc6c9457ca1fd8828044675d", "status": "f2p_not_failing_prefix", "verify_status": null, "error": null, "timing": {"setup": 13.1, "pre_test_0": 2179.8, "pre_test_1": 1822.1, "post_test_0": 2129.1, "post_test_1": 1853.3, "total": 8003.0}, "test_cmds": ["cd /tmp/cache/repos/noir-lang__noir && cargo test --manifest-path repo/Cargo.toml -- --nocapture 2>&1 | tee reports/test-output.log"], "rebuild_cmds": [], "print_cmds": [], "f2p_pre_ok": false, "pre_detail": {"missing": 0, "wrong": [["tests::interpret_execution_success::test_array_if_cond_simple::forcebrillig_false_inliner_0_expects", "pass"], ["tests::interpret_execution_success::test_a_1327_concrete_in_generic::forcebrillig_true_inliner_i64_max_expects", "pass"], ["tests::execution_success::test_unrolling_regression_8333::forcebrillig_false_inliner_0_expects", "pass"], ["tests::execution_success::test_tuples::forcebrillig_false_inliner_0_expects", "pass"], ["tests::execution_success::test_traits_in_crates_2::forcebrillig_true_inliner_0_expects", "pass"], ["tests::execution_success::test_witness_compression::forcebrillig_false_inliner_i64_min_expects", "pass"], ["tests::interpret_execution_success::test_a_1327_concrete_in_generic::forcebrillig_false_inliner_i64_min_expects", "pass"], ["tests::execution_success::test_while_loop_break_regression_8521::forcebrillig_true_inliner_i64_max_expects", "pass"], ["tests::interpret_execution_success::test_array_dynamic_main_output::forcebrillig_true_inliner_i64_max_expects", "pass"], ["tests::interpret_execution_success::test_a_5_over::forcebrillig_true_inliner_0_expects", "pass"]], "missing_ids": [], "parsed_count": 5390}, "p2p_env_dropped_count": 1099, "f2p_post_ok": false, "p2p_post_ok": true, "post_detail": {"missing": 158, "wrong": [], "missing_ids": ["tests::interpret_execution_failure::test_hashmap_load_factor::forcebrillig_false_inliner_0_expects", "tests::interpret_execution_failure::test_unused_array_set_known_index_out_of_bounds::forcebrillig_true_inliner_0_expects", "tests::interpret_execution_failure::test_ecdsa_secp256r1_invalid_pubkey::forcebrillig_true_inliner_0_expects", "tests::interpret_execution_failure::test_regression_9489::forcebrillig_true_inliner_0_expects", "tests::interpret_execution_failure::test_regression_8175::forcebrillig_true_inliner_0_expects"], "parsed_count": 5491}, "raw_tail": "regression_8009 ... ok\ntest tests::nargo_expand_execution_success::test_regression_8011 ... ok\ntest tests::nargo_expand_execution_success::test_regression_8174 ... ok\ntest tests::nargo_expand_execution_success::test_regression_8212 ... ok\ntest tests::nargo_expand_execution_success::test_regression_8235 ... ok\ntest tests::nargo_expand_execution_success::test_ram_blowup_regression has been running for over 60 seconds\ntest tests::nargo_expand_execution_success::test_regression_8236 ... ok\ntest tests::nargo_expand_execution_success::test_regression_8261 ... ok\ntest tests::nargo_expand_execution_success::test_regression_8305 ... ok\ntest tests::nargo_expand_execution_success::test_regression_8329 ... ok\ntest tests::nargo_expand_execution_success::test_regression_8519 ... ok\ntest tests::nargo_expand_execution_success::test_regression_8558 ... ok\ntest tests::nargo_expand_execution_success::test_regression_8662 ... ok\ntest tests::nargo_expand_execution_success::test_regression_8726 ... ok\ntest tests::nargo_expand_execution_success::test_regression_8729 ... ok\ntest tests::nargo_expand_execution_success::test_regression_8739 ... ok\ntest tests::nargo_expand_execution_success::test_regression_8755 ... ok\ntest tests::nargo_expand_execution_success::test_regression_8761 ... ok\ntest tests::nargo_expand_execution_success::test_regression_8779 ... ok\ntest tests::nargo_expand_execution_success::test_regression_8874 ... ok\ntest tests::nargo_expand_execution_success::test_regression_8890 ... ok\n\n"}
{"id": "patchbench-rust-real-0026", "repo": "noir-lang/noir", "base_commit": "e7fb7f3bf083de9fc6d430e7c30a571ea94534e4", "status": "no_tests_parsed", "verify_status": null, "error": null, "timing": {"setup": 2.9, "pre_test_0": 30.9, "pre_test_1": 3.6, "post_test_0": 32.1, "post_test_1": 3.6, "total": 81.2}, "test_cmds": ["export PATH=/usr/local/cargo/bin:$PATH; cd /tmp/cache/repos/noir-lang__noir/repo && mkdir -p reports && cargo test --workspace -- --nocapture 2>&1 | tee reports/test-output.log"], "rebuild_cmds": [], "print_cmds": [], "f2p_pre_ok": true, "pre_detail": {"missing": 0, "wrong": [], "missing_ids": [], "parsed_count": 0}, "p2p_env_dropped_count": 4113, "f2p_post_ok": false, "p2p_post_ok": true, "post_detail": {"missing": 2, "wrong": [], "missing_ids": ["acir_field::field_element::tests::test_try_into_i128", "solver::unsatisfied_opcode_resolved_brillig"], "parsed_count": 0}, "raw_tail": "/tmp/pb_cmd.sh: line 1: cd: /tmp/cache/repos/noir-lang__noir/repo: No such file or directory\n\n\n"}