Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gitignore globs are read from enclosing directories, so tree is not copied #450

Closed
autarch opened this issue Nov 20, 2024 · 12 comments · Fixed by #458
Closed

gitignore globs are read from enclosing directories, so tree is not copied #450

autarch opened this issue Nov 20, 2024 · 12 comments · Fixed by #458
Assignees
Labels
bug Something isn't working copy_tree Copying trees to build dirs

Comments

@autarch
Copy link

autarch commented Nov 20, 2024

I'm trying to run cargo-mutants for my ubi crate (https://github.com/houseabsolute/ubi/) like this:

cargo mutants -p ubi -L trace

This gives me the following output:

DEBUG output: {"root":"/home/autarch/projects/ubi/Cargo.toml"}
DEBUG Found workspace root manifest cargo_toml_path="/home/autarch/projects/ubi/Cargo.toml"
DEBUG Find root files manifest_path="/home/autarch/projects/ubi/Cargo.toml"
DEBUG Found workspace root workspace_root="/home/autarch/projects/ubi"
DEBUG package{name=ubi}: walk package manifest_path=/home/autarch/projects/ubi/ubi/Cargo.toml
DEBUG package{name=ubi}: found mutation target ubi/src/lib.rs of kind ["lib"]
DEBUG package{name=ubi}: skipping target "build-script-build" of kinds ["custom-build"]
DEBUG package{name=ubi-cli}: walk package manifest_path=/home/autarch/projects/ubi/ubi-cli/Cargo.toml
DEBUG package{name=ubi-cli}: found mutation target ubi-cli/src/main.rs of kind ["bin"]
DEBUG package{name=ubi-cli}: skipping target "ubi" of kinds ["test"]
DEBUG config=Config { cap_lints: false, error_values: [], examine_globs: [], exclude_globs: [], exclude_re: [], examine_re: [], additional_cargo_args: [], ad}
DEBUG args.features=Features { features: [], no_default_features: false, all_features: false }
DEBUG options=Options { baseline: Run, cap_lints: false, check_only: false, gitignore: true, in_place: false, jobserver: true, jobserver_tasks: None, leak_di}
DEBUG source_file{path="ubi/src/lib.rs"}: visit source file
TRACE source_file{path="ubi/src/lib.rs"}:fn{line=93 name="project"}: Return type is not recognized, trying Default type_=Type::Path { qself: None, path: Path}
TRACE source_file{path="ubi/src/lib.rs"}:fn{line=101 name="tag"}: Return type is not recognized, trying Default type_=Type::Path { qself: None, path: Path { }
TRACE source_file{path="ubi/src/lib.rs"}:fn{line=113 name="url"}: Return type is not recognized, trying Default type_=Type::Path { qself: None, path: Path { }
TRACE source_file{path="ubi/src/lib.rs"}:fn{line=120 name="install_dir"}: Return type is not recognized, trying Default type_=Type::Path { qself: None, path:}
TRACE source_file{path="ubi/src/lib.rs"}:fn{line=130 name="matching"}: Return type is not recognized, trying Default type_=Type::Path { qself: None, path: Pa}
TRACE source_file{path="ubi/src/lib.rs"}:fn{line=139 name="exe"}: Return type is not recognized, trying Default type_=Type::Path { qself: None, path: Path { }
TRACE source_file{path="ubi/src/lib.rs"}:fn{line=147 name="github_token"}: Return type is not recognized, trying Default type_=Type::Path { qself: None, path}
TRACE source_file{path="ubi/src/lib.rs"}:fn{line=155 name="platform"}: Return type is not recognized, trying Default type_=Type::Path { qself: None, path: Pa}
TRACE source_file{path="ubi/src/lib.rs"}:fn{line=164 name="is_musl"}: Return type is not recognized, trying Default type_=Type::Path { qself: None, path: Pat}
TRACE source_file{path="ubi/src/lib.rs"}:fn{line=172 name="github_api_url_base"}: Return type is not recognized, trying Default type_=Type::Path { qself: Non}
TRACE source_file{path="ubi/src/lib.rs"}:fn{line=186 name="build"}: Return type is not recognized, trying Default type_=Type::Path { qself: None, path: Path }
TRACE source_file{path="ubi/src/lib.rs"}:fn{line=186 name="build"}:binary{line=187}: visit binary operator
TRACE source_file{path="ubi/src/lib.rs"}:fn{line=186 name="build"}:binary{line=190}: visit binary operator
TRACE source_file{path="ubi/src/lib.rs"}:fn{line=186 name="build"}:binary{line=190}:binary{line=190}: visit binary operator
TRACE source_file{path="ubi/src/lib.rs"}:fn{line=186 name="build"}:binary{line=207}: visit binary operator
TRACE source_file{path="ubi/src/lib.rs"}:fn{line=186 name="build"}:binary{line=207}:binary{line=207}: visit binary operator
TRACE source_file{path="ubi/src/lib.rs"}:fn{line=232 name="platform_is_musl"}: visit fn
TRACE source_file{path="ubi/src/lib.rs"}:fn{line=232 name="platform_is_musl"}:binary{line=233}: visit binary operator
TRACE source_file{path="ubi/src/lib.rs"}:fn{line=232 name="platform_is_musl"}:binary{line=247}: visit binary operator
TRACE source_file{path="ubi/src/lib.rs"}:fn{line=296 name="parse_project_name"}:binary{line=313}: visit binary operator
TRACE source_file{path="ubi/src/lib.rs"}:fn{line=296 name="parse_project_name"}:binary{line=313}:binary{line=313}: visit binary operator
TRACE source_file{path="ubi/src/lib.rs"}:fn{line=296 name="parse_project_name"}:binary{line=313}:binary{line=313}:binary{line=313}: visit binary operator
TRACE source_file{path="ubi/src/lib.rs"}:fn{line=324 name="exe_name"}:binary{line=332}: visit binary operator
TRACE source_file{path="ubi/src/lib.rs"}:fn{line=343 name="install_path"}: Return type is not recognized, trying Default type_=Type::Path { qself: None, path}
TRACE source_file{path="ubi/src/lib.rs"}:fn{line=357 name="reqwest_client"}: Return type is not recognized, trying Default type_=Type::Path { qself: None, pa}
TRACE source_file{path="ubi/src/lib.rs"}:fn{line=406 name="asset"}: Return type is not recognized, trying Default type_=Type::Path { qself: None, path: Path }
TRACE source_file{path="ubi/src/lib.rs"}:fn{line=416 name="download_asset"}: Return type is not recognized, trying Default type_=Type::Path { qself: None, pa}
TRACE source_file{path="ubi/src/lib.rs"}:fn{line=416 name="download_asset"}:binary{line=424}: visit binary operator
TRACE source_file{path="ubi/src/lib.rs"}:fn{line=465 name="init_logger"}: visit fn
DEBUG source_file{path="ubi/src/lib.rs"}:fn{line=465 name="init_logger"}: Attribute is not in conventional form; skipped err=Error("expected `,`") attr=Attri}
TRACE source_file{path="ubi/src/lib.rs"}:mod{line=495 mod_name="test"}: mod excluded by attrs
TRACE found submodule in /home/autarch/projects/ubi/ubi/src/arch.rs
TRACE found submodule in /home/autarch/projects/ubi/ubi/src/extension.rs
TRACE found submodule in /home/autarch/projects/ubi/ubi/src/fetcher.rs
TRACE found submodule in /home/autarch/projects/ubi/ubi/src/installer.rs
TRACE found submodule in /home/autarch/projects/ubi/ubi/src/os.rs
TRACE found submodule in /home/autarch/projects/ubi/ubi/src/picker.rs
TRACE found submodule in /home/autarch/projects/ubi/ubi/src/release.rs
DEBUG source_file{path="ubi/src/arch.rs"}: visit source file
TRACE source_file{path="ubi/src/arch.rs"}:fn{line=7 name="macos_aarch64_re"}: visit fn
TRACE source_file{path="ubi/src/arch.rs"}:fn{line=7 name="macos_aarch64_re"}: Return type is not recognized, trying Default type_=Type::Path { qself: None, p}
TRACE source_file{path="ubi/src/arch.rs"}:fn{line=35 name="aarch64_re"}: visit fn
TRACE source_file{path="ubi/src/arch.rs"}:fn{line=35 name="aarch64_re"}: Return type is not recognized, trying Default type_=Type::Path { qself: None, path: }
TRACE source_file{path="ubi/src/arch.rs"}:fn{line=57 name="arm_re"}: visit fn
TRACE source_file{path="ubi/src/arch.rs"}:fn{line=57 name="arm_re"}: Return type is not recognized, trying Default type_=Type::Path { qself: None, path: Path}
TRACE source_file{path="ubi/src/arch.rs"}:fn{line=75 name="mipsle_re"}: visit fn
TRACE source_file{path="ubi/src/arch.rs"}:fn{line=75 name="mipsle_re"}: Return type is not recognized, trying Default type_=Type::Path { qself: None, path: P}
TRACE source_file{path="ubi/src/arch.rs"}:fn{line=93 name="mips_re"}: visit fn
TRACE source_file{path="ubi/src/arch.rs"}:fn{line=93 name="mips_re"}: Return type is not recognized, trying Default type_=Type::Path { qself: None, path: Pat}
TRACE source_file{path="ubi/src/arch.rs"}:fn{line=111 name="mips64le_re"}: visit fn
TRACE source_file{path="ubi/src/arch.rs"}:fn{line=111 name="mips64le_re"}: Return type is not recognized, trying Default type_=Type::Path { qself: None, path}
TRACE source_file{path="ubi/src/arch.rs"}:fn{line=129 name="mips64_re"}: visit fn
TRACE source_file{path="ubi/src/arch.rs"}:fn{line=129 name="mips64_re"}: Return type is not recognized, trying Default type_=Type::Path { qself: None, path: }
TRACE source_file{path="ubi/src/arch.rs"}:fn{line=147 name="ppc32_re"}: visit fn
TRACE source_file{path="ubi/src/arch.rs"}:fn{line=147 name="ppc32_re"}: Return type is not recognized, trying Default type_=Type::Path { qself: None, path: P}
TRACE source_file{path="ubi/src/arch.rs"}:fn{line=169 name="ppc64_re"}: visit fn
TRACE source_file{path="ubi/src/arch.rs"}:fn{line=169 name="ppc64_re"}: Return type is not recognized, trying Default type_=Type::Path { qself: None, path: P}
TRACE source_file{path="ubi/src/arch.rs"}:fn{line=202 name="ppc64le_re"}: visit fn
TRACE source_file{path="ubi/src/arch.rs"}:fn{line=202 name="ppc64le_re"}: Return type is not recognized, trying Default type_=Type::Path { qself: None, path:}
TRACE source_file{path="ubi/src/arch.rs"}:fn{line=235 name="riscv64_re"}: visit fn
TRACE source_file{path="ubi/src/arch.rs"}:fn{line=235 name="riscv64_re"}: Return type is not recognized, trying Default type_=Type::Path { qself: None, path:}
TRACE source_file{path="ubi/src/arch.rs"}:fn{line=253 name="s390x_re"}: visit fn
TRACE source_file{path="ubi/src/arch.rs"}:fn{line=253 name="s390x_re"}: Return type is not recognized, trying Default type_=Type::Path { qself: None, path: P}
TRACE source_file{path="ubi/src/arch.rs"}:fn{line=271 name="sparc64_re"}: visit fn
TRACE source_file{path="ubi/src/arch.rs"}:fn{line=271 name="sparc64_re"}: Return type is not recognized, trying Default type_=Type::Path { qself: None, path:}
TRACE source_file{path="ubi/src/arch.rs"}:fn{line=289 name="x86_32_re"}: visit fn
TRACE source_file{path="ubi/src/arch.rs"}:fn{line=289 name="x86_32_re"}: Return type is not recognized, trying Default type_=Type::Path { qself: None, path: }
TRACE source_file{path="ubi/src/arch.rs"}:fn{line=315 name="x86_64_re"}: visit fn
TRACE source_file{path="ubi/src/arch.rs"}:fn{line=315 name="x86_64_re"}: Return type is not recognized, trying Default type_=Type::Path { qself: None, path: }
DEBUG source_file{path="ubi/src/extension.rs"}: visit source file
TRACE source_file{path="ubi/src/extension.rs"}:fn{line=56 name="from_path"}: Return type is not recognized, trying Default type_=Type::Path { qself: None, pa}
TRACE source_file{path="ubi/src/extension.rs"}:fn{line=90 name="extension_is_part_of_version"}: visit fn
TRACE source_file{path="ubi/src/extension.rs"}:fn{line=90 name="extension_is_part_of_version"}:binary{line=109}: visit binary operator
TRACE source_file{path="ubi/src/extension.rs"}:fn{line=112 name="extension_is_platform"}: visit fn
TRACE source_file{path="ubi/src/extension.rs"}:mod{line=127 mod_name="test"}: mod excluded by attrs
DEBUG source_file{path="ubi/src/fetcher.rs"}: visit source file
TRACE source_file{path="ubi/src/fetcher.rs"}:fn{line=31 name="fetch_assets"}: Return type is not recognized, trying Default type_=Type::Path { qself: None, p}
TRACE source_file{path="ubi/src/fetcher.rs"}:fn{line=42 name="release_info"}: Return type is not recognized, trying Default type_=Type::Path { qself: None, p}
DEBUG source_file{path="ubi/src/installer.rs"}: visit source file
TRACE source_file{path="ubi/src/installer.rs"}:fn{line=90 name="extract_tarball"}:unary{line=100}: visit unary operator
TRACE source_file{path="ubi/src/installer.rs"}:fn{line=90 name="extract_tarball"}:binary{line=106}: visit binary operator
TRACE source_file{path="ubi/src/installer.rs"}:fn{line=171 name="tar_reader_for"}: visit fn
TRACE source_file{path="ubi/src/installer.rs"}:fn{line=171 name="tar_reader_for"}: Return type is not recognized, trying Default type_=Type::TraitObject { dy}
TRACE source_file{path="ubi/src/installer.rs"}:fn{line=194 name="open_file"}: visit fn
TRACE source_file{path="ubi/src/installer.rs"}:fn{line=194 name="open_file"}: Return type is not recognized, trying Default type_=Type::Path { qself: None, p}
TRACE source_file{path="ubi/src/installer.rs"}:mod{line=199 mod_name="tests"}: mod excluded by attrs
DEBUG source_file{path="ubi/src/os.rs"}: visit source file
TRACE source_file{path="ubi/src/os.rs"}:fn{line=5 name="freebsd_re"}: visit fn
TRACE source_file{path="ubi/src/os.rs"}:fn{line=5 name="freebsd_re"}: Return type is not recognized, trying Default type_=Type::Path { qself: None, path: Pat}
TRACE source_file{path="ubi/src/os.rs"}:fn{line=9 name="fuchsia"}: visit fn
TRACE source_file{path="ubi/src/os.rs"}:fn{line=9 name="fuchsia"}: Return type is not recognized, trying Default type_=Type::Path { qself: None, path: Path {}
TRACE source_file{path="ubi/src/os.rs"}:fn{line=13 name="illumos_re"}: visit fn
TRACE source_file{path="ubi/src/os.rs"}:fn{line=13 name="illumos_re"}: Return type is not recognized, trying Default type_=Type::Path { qself: None, path: Pa}
TRACE source_file{path="ubi/src/os.rs"}:fn{line=17 name="linux_re"}: visit fn
TRACE source_file{path="ubi/src/os.rs"}:fn{line=17 name="linux_re"}: Return type is not recognized, trying Default type_=Type::Path { qself: None, path: Path}
TRACE source_file{path="ubi/src/os.rs"}:fn{line=21 name="macos_re"}: visit fn
TRACE source_file{path="ubi/src/os.rs"}:fn{line=21 name="macos_re"}: Return type is not recognized, trying Default type_=Type::Path { qself: None, path: Path}
TRACE source_file{path="ubi/src/os.rs"}:fn{line=25 name="netbsd_re"}: visit fn
TRACE source_file{path="ubi/src/os.rs"}:fn{line=25 name="netbsd_re"}: Return type is not recognized, trying Default type_=Type::Path { qself: None, path: Pat}
TRACE source_file{path="ubi/src/os.rs"}:fn{line=29 name="solaris_re"}: visit fn
TRACE source_file{path="ubi/src/os.rs"}:fn{line=29 name="solaris_re"}: Return type is not recognized, trying Default type_=Type::Path { qself: None, path: Pa}
TRACE source_file{path="ubi/src/os.rs"}:fn{line=33 name="windows_re"}: visit fn
TRACE source_file{path="ubi/src/os.rs"}:fn{line=33 name="windows_re"}: Return type is not recognized, trying Default type_=Type::Path { qself: None, path: Pa}
DEBUG source_file{path="ubi/src/picker.rs"}: visit source file
TRACE source_file{path="ubi/src/picker.rs"}:fn{line=34 name="pick_asset"}: Return type is not recognized, trying Default type_=Type::Path { qself: None, path}
TRACE source_file{path="ubi/src/picker.rs"}:fn{line=34 name="pick_asset"}:binary{line=47}: visit binary operator
TRACE source_file{path="ubi/src/picker.rs"}:fn{line=86 name="os_matches"}: Return type is not recognized, trying Default type_=Type::Path { qself: None, path}
TRACE source_file{path="ubi/src/picker.rs"}:fn{line=108 name="arch_matches"}: Return type is not recognized, trying Default type_=Type::Path { qself: None, p}
TRACE source_file{path="ubi/src/picker.rs"}:fn{line=108 name="arch_matches"}:binary{line=116}: visit binary operator
TRACE source_file{path="ubi/src/picker.rs"}:fn{line=158 name="libc_matches"}: Return type is not recognized, trying Default type_=Type::Path { qself: None, p}
TRACE source_file{path="ubi/src/picker.rs"}:fn{line=158 name="libc_matches"}:unary{line=159}: visit unary operator
TRACE source_file{path="ubi/src/picker.rs"}:fn{line=158 name="libc_matches"}:binary{line=168}: visit binary operator
TRACE source_file{path="ubi/src/picker.rs"}:fn{line=183 name="libc_name"}:binary{line=186}: visit binary operator
TRACE source_file{path="ubi/src/picker.rs"}:fn{line=193 name="pick_asset_from_matches"}: Return type is not recognized, trying Default type_=Type::Path { qse}
TRACE source_file{path="ubi/src/picker.rs"}:fn{line=193 name="pick_asset_from_matches"}:binary{line=194}: visit binary operator
TRACE source_file{path="ubi/src/picker.rs"}:fn{line=193 name="pick_asset_from_matches"}:binary{line=206}: visit binary operator
TRACE source_file{path="ubi/src/picker.rs"}:fn{line=230 name="maybe_filter_for_64_bit_arch"}: Return type is not recognized, trying Default type_=Type::Path }
TRACE source_file{path="ubi/src/picker.rs"}:fn{line=230 name="maybe_filter_for_64_bit_arch"}:unary{line=231}: visit unary operator
TRACE source_file{path="ubi/src/picker.rs"}:fn{line=230 name="maybe_filter_for_64_bit_arch"}:unary{line=250}: visit unary operator
TRACE source_file{path="ubi/src/picker.rs"}:fn{line=266 name="maybe_filter_for_matching_string"}: Return type is not recognized, trying Default type_=Type::P}
TRACE source_file{path="ubi/src/picker.rs"}:fn{line=266 name="maybe_filter_for_matching_string"}: Return type is not recognized, trying Default type_=Type::P}
TRACE source_file{path="ubi/src/picker.rs"}:fn{line=290 name="maybe_pick_asset_for_macos_arm"}: Return type is not recognized, trying Default type_=Type::Pat}
TRACE source_file{path="ubi/src/picker.rs"}:fn{line=290 name="maybe_pick_asset_for_macos_arm"}: Return type is not recognized, trying Default type_=Type::Pat}
TRACE source_file{path="ubi/src/picker.rs"}:fn{line=290 name="maybe_pick_asset_for_macos_arm"}:unary{line=294}: visit unary operator
TRACE source_file{path="ubi/src/picker.rs"}:fn{line=315 name="maybe_filter_for_musl_platform"}: Return type is not recognized, trying Default type_=Type::Pat}
TRACE source_file{path="ubi/src/picker.rs"}:fn{line=315 name="maybe_filter_for_musl_platform"}:unary{line=316}: visit unary operator
TRACE source_file{path="ubi/src/picker.rs"}:fn{line=315 name="maybe_filter_for_musl_platform"}:unary{line=326}: visit unary operator
TRACE source_file{path="ubi/src/picker.rs"}:fn{line=342 name="os_matcher"}: Return type is not recognized, trying Default type_=Type::Path { qself: None, pat}
TRACE source_file{path="ubi/src/picker.rs"}:fn{line=372 name="arch_matcher"}: Return type is not recognized, trying Default type_=Type::Path { qself: None, p}
TRACE source_file{path="ubi/src/picker.rs"}:fn{line=404 name="running_on_macos_arm"}:binary{line=405}: visit binary operator
TRACE source_file{path="ubi/src/picker.rs"}:fn{line=404 name="running_on_macos_arm"}:binary{line=405}:binary{line=405}: visit binary operator
TRACE source_file{path="ubi/src/picker.rs"}:fn{line=404 name="running_on_macos_arm"}:binary{line=405}:binary{line=405}: visit binary operator
TRACE source_file{path="ubi/src/picker.rs"}:mod{line=410 mod_name="test"}: mod excluded by attrs
DEBUG source_file{path="ubi/src/release.rs"}: visit source file
Found 205 mutants to test
DEBUG glob converted to regex: Glob { glob: "**/*", re: "(?-u)^(?:/?|.*/)[^/]*$", opts: GlobOptions { case_insensitive: false, literal_separator: true, backs 
DEBUG built glob set; 0 literals, 0 basenames, 0 extensions, 0 prefixes, 0 suffixes, 0 required extensions, 1 regexes    
DEBUG built glob set; 4 literals, 0 basenames, 0 extensions, 0 prefixes, 0 suffixes, 0 required extensions, 0 regexes    
DEBUG ignoring /home/autarch/projects/ubi/package-lock.json: Ignore(IgnoreMatch(Gitignore(Glob { from: Some("/home/autarch/projects/ubi/.gitignore"), origina 
DEBUG ignoring /home/autarch/projects/ubi/.github: Ignore(IgnoreMatch(Gitignore(Glob { from: Some("/home/autarch/.gitignore"), original: "*", actual: "**/*", 
DEBUG ignoring /home/autarch/projects/ubi/ubi-cli: Ignore(IgnoreMatch(Gitignore(Glob { from: Some("/home/autarch/.gitignore"), original: "*", actual: "**/*", 
DEBUG ignoring /home/autarch/projects/ubi/LICENSE-MIT: Ignore(IgnoreMatch(Gitignore(Glob { from: Some("/home/autarch/.gitignore"), original: "*", actual: "** 
DEBUG ignoring /home/autarch/projects/ubi/Cargo.lock: Ignore(IgnoreMatch(Gitignore(Glob { from: Some("/home/autarch/.gitignore"), original: "*", actual: "**/ 
DEBUG ignoring /home/autarch/projects/ubi/mutants.out: Ignore(IgnoreMatch(Gitignore(Glob { from: Some("/home/autarch/.gitignore"), original: "*", actual: "** 
DEBUG ignoring /home/autarch/projects/ubi/do-release.sh: Ignore(IgnoreMatch(Gitignore(Glob { from: Some("/home/autarch/.gitignore"), original: "*", actual: " 
DEBUG ignoring /home/autarch/projects/ubi/Cross.toml: Ignore(IgnoreMatch(Gitignore(Glob { from: Some("/home/autarch/.gitignore"), original: "*", actual: "**/ 
DEBUG ignoring /home/autarch/projects/ubi/.git: Ignore(IgnoreMatch(Gitignore(Glob { from: Some("/home/autarch/.gitignore"), original: "*", actual: "**/*", is 
DEBUG ignoring /home/autarch/projects/ubi/LICENSE-APACHE: Ignore(IgnoreMatch(Gitignore(Glob { from: Some("/home/autarch/.gitignore"), original: "*", actual:  
DEBUG ignoring /home/autarch/projects/ubi/release.toml: Ignore(IgnoreMatch(Gitignore(Glob { from: Some("/home/autarch/.gitignore"), original: "*", actual: "* 
DEBUG ignoring /home/autarch/projects/ubi/ubi: Ignore(IgnoreMatch(Gitignore(Glob { from: Some("/home/autarch/.gitignore"), original: "*", actual: "**/*", is_ 
DEBUG ignoring /home/autarch/projects/ubi/.gitignore: Ignore(IgnoreMatch(Gitignore(Glob { from: Some("/home/autarch/.gitignore"), original: "*", actual: "**/ 
DEBUG ignoring /home/autarch/projects/ubi/.typos.toml: Ignore(IgnoreMatch(Gitignore(Glob { from: Some("/home/autarch/.gitignore"), original: "*", actual: "** 
DEBUG ignoring /home/autarch/projects/ubi/node_modules: Ignore(IgnoreMatch(Gitignore(Glob { from: Some("/home/autarch/projects/ubi/.gitignore"), original: "/ 
DEBUG ignoring /home/autarch/projects/ubi/dev: Ignore(IgnoreMatch(Gitignore(Glob { from: Some("/home/autarch/.gitignore"), original: "*", actual: "**/*", is_ 
DEBUG ignoring /home/autarch/projects/ubi/Cargo.toml: Ignore(IgnoreMatch(Gitignore(Glob { from: Some("/home/autarch/.gitignore"), original: "*", actual: "**/ 
DEBUG ignoring /home/autarch/projects/ubi/bootstrap: Ignore(IgnoreMatch(Gitignore(Glob { from: Some("/home/autarch/.gitignore"), original: "*", actual: "**/* 
DEBUG ignoring /home/autarch/projects/ubi/precious.toml: Ignore(IgnoreMatch(Gitignore(Glob { from: Some("/home/autarch/.gitignore"), original: "*", actual: " 
DEBUG ignoring /home/autarch/projects/ubi/Changes.md: Ignore(IgnoreMatch(Gitignore(Glob { from: Some("/home/autarch/.gitignore"), original: "*", actual: "**/ 
DEBUG ignoring /home/autarch/projects/ubi/rustfmt.toml: Ignore(IgnoreMatch(Gitignore(Glob { from: Some("/home/autarch/.gitignore"), original: "*", actual: "* 
DEBUG ignoring /home/autarch/projects/ubi/target: Ignore(IgnoreMatch(Gitignore(Glob { from: Some("/home/autarch/projects/ubi/.gitignore"), original: "/target 
DEBUG ignoring /home/autarch/projects/ubi/README.md: Ignore(IgnoreMatch(Gitignore(Glob { from: Some("/home/autarch/.gitignore"), original: "*", actual: "**/* 
DEBUG ignoring /home/autarch/projects/ubi/package.json: Ignore(IgnoreMatch(Gitignore(Glob { from: Some("/home/autarch/projects/ubi/.gitignore"), original: "/ 
DEBUG ignoring /home/autarch/projects/ubi/git: Ignore(IgnoreMatch(Gitignore(Glob { from: Some("/home/autarch/.gitignore"), original: "*", actual: "**/*", is_ 
DEBUG Copied source tree total_bytes=0 total_files=0 temp_dir="/tmp/cargo-mutants-ubi-WI5h83.tmp"
Error: read manifest

Caused by:
    No such file or directory (os error 2)

If I pass --leak-dirs, I note that the directory in /tmp doesn't seem to exist. I tried setting TMPDIR=$HOME/tmp and that led to the same error, which no temp directory being created.

@sourcefrog

This comment was marked as outdated.

@autarch
Copy link
Author

autarch commented Nov 20, 2024

That's why I tried to just test the ubipackage.

@sourcefrog
Copy link
Owner

sourcefrog commented Nov 20, 2024

cargo mutants -p ubi seems to be working for me.

Ah actually this seems to be the problem:

DEBUG glob converted to regex: Glob { glob: "**/*", re: "(?-u)^(?:/?|.*/)[^/]*$", opts: GlobOptions { case_insensitive: false, literal_separator: true, backs 
DEBUG built glob set; 0 literals, 0 basenames, 0 extensions, 0 prefixes, 0 suffixes, 0 required extensions, 1 regexes    
DEBUG built glob set; 4 literals, 0 basenames, 0 extensions, 0 prefixes, 0 suffixes, 0 required extensions, 0 regexes    
DEBUG ignoring /home/autarch/projects/ubi/package-lock.json: Ignore(IgnoreMatch(Gitignore(Glob { from: Some("/home/autarch/projects/ubi/.gitignore"), origina 
DEBUG ignoring /home/autarch/projects/ubi/.github: Ignore(IgnoreMatch(Gitignore(Glob { from: Some("/home/autarch/.gitignore"), original: "*", actual: "**/*", 
DEBUG ignoring /home/autarch/projects/ubi/ubi-cli: Ignore(IgnoreMatch(Gitignore(Glob { from: Some("/home/autarch/.gitignore"), original: "*", actual: "**/*", 

You seem to have either * or **/* in /home/autarch/.gitignore, which is making the glob crate think every file should be ignored, so nothing gets copied. I don't have that, which is why it didn't reproduce for me.

A couple of workarounds for now:

  1. Use --in-place to build without copying
  2. Use --gitignore false to skip using these files

I guess a proper fix would be that git ignore only follows parents up to the root of the git tree, so the gitignore implementation shouldn't look in your home either. I'm not sure if this is a bug in the ignore crate or if cargo-mutants is using it the wrong way.

Also, if we copy nothing maybe we should say so although it seems a bit of an edge case.

@sourcefrog sourcefrog changed the title "No such file or directory" error gitignore globs are read from enclosing directories, so tree is not copied Nov 20, 2024
@sourcefrog
Copy link
Owner

Actually can I just confirm there is a .git directory under projects/ubi?

@autarch
Copy link
Author

autarch commented Nov 21, 2024

Actually can I just confirm there is a .git directory under projects/ubi?

Yes, I ran cargo mutants from that directory, which is a clone of the remote repo here on GitHub.

@autarch
Copy link
Author

autarch commented Nov 21, 2024

cargo mutants -p ubi seems to be working for me.

Ah actually this seems to be the problem:

DEBUG glob converted to regex: Glob { glob: "**/*", re: "(?-u)^(?:/?|.*/)[^/]*$", opts: GlobOptions { case_insensitive: false, literal_separator: true, backs 
DEBUG built glob set; 0 literals, 0 basenames, 0 extensions, 0 prefixes, 0 suffixes, 0 required extensions, 1 regexes    
DEBUG built glob set; 4 literals, 0 basenames, 0 extensions, 0 prefixes, 0 suffixes, 0 required extensions, 0 regexes    
DEBUG ignoring /home/autarch/projects/ubi/package-lock.json: Ignore(IgnoreMatch(Gitignore(Glob { from: Some("/home/autarch/projects/ubi/.gitignore"), origina 
DEBUG ignoring /home/autarch/projects/ubi/.github: Ignore(IgnoreMatch(Gitignore(Glob { from: Some("/home/autarch/.gitignore"), original: "*", actual: "**/*", 
DEBUG ignoring /home/autarch/projects/ubi/ubi-cli: Ignore(IgnoreMatch(Gitignore(Glob { from: Some("/home/autarch/.gitignore"), original: "*", actual: "**/*", 

You seem to have either * or **/* in /home/autarch/.gitignore, which is making the glob crate think every file should be ignored, so nothing gets copied. I don't have that, which is why it didn't reproduce for me.

A couple of workarounds for now:

  1. Use --in-place to build without copying
  2. Use --gitignore false to skip using these files

I guess a proper fix would be that git ignore only follows parents up to the root of the git tree, so the gitignore implementation shouldn't look in your home either. I'm not sure if this is a bug in the ignore crate or if cargo-mutants is using it the wrong way.

Also, if we copy nothing maybe we should say so although it seems a bit of an edge case.

Hmm, this is interesting. I also use the ignore crate for a project of mine, precious, but I've not seen this issue before.

I have that ~/.gitignore in place because my home directory is a git repo as well. I check in things like my .bashrc and other files. But I only want to track files that I explicitly add to the repo. Without that ignore in place, git will treat every single file in my home directory as an untracked file.

@sourcefrog
Copy link
Owner

Yep, I know that pattern of ignoring *, and it's totally reasonable, it's just somehow we are including globs above the git root.

This comes from

for entry in WalkBuilder::new(from_path)
.standard_filters(gitignore)
.hidden(false)
.ignore(false)
.require_git(false)
.filter_entry(|entry| {
!SOURCE_EXCLUDE.contains(&entry.file_name().to_string_lossy().as_ref())
})
.build()
{

Although, broader than this bug, you've helped me realize that people might be using the "ignored but added" pattern even inside their source tree, and so using it while copying would make an unusable copy. Maybe using gitignores isn't a good default.

@autarch
Copy link
Author

autarch commented Nov 22, 2024

Oh, I see. It's the copying to a new location that caused the issue. I think maybe you should also copy .git/config or something like that.

@sourcefrog
Copy link
Owner

Yes, the problem is to do with copying. If you use --in-place it won't need to copy so it should work.

Can you say more about why to copy .git/config?

@sourcefrog
Copy link
Owner

Just confirming that I can reproduce this with * in a parent directory.

@autarch
Copy link
Author

autarch commented Nov 23, 2024

I haven't dug into the code, but I was thinking that the presence of a .git/config file in the copy of the repo might cause the ignore crate to not look at $HOME/.gitignore.

@sourcefrog
Copy link
Owner

Also confirming I can reproduce this with a minimal repo created by cargo init --vcs git foo inside a directory ignoring *.

I think the problem is that ignore only stops at the git root directory if require_git is set, and we weren't setting it.

https://github.com/BurntSushi/ripgrep/blob/79cbe89deb1151e703f4d91b19af9cdcc128b765/crates/ignore/src/dir.rs#L213-L218

So this is basically BurntSushi/ripgrep#2812 (comment)

@sourcefrog sourcefrog self-assigned this Nov 23, 2024
@sourcefrog sourcefrog added the bug Something isn't working label Nov 23, 2024
sourcefrog added a commit that referenced this issue Nov 24, 2024
@sourcefrog sourcefrog linked a pull request Nov 24, 2024 that will close this issue
sourcefrog added a commit that referenced this issue Nov 24, 2024
Also, only read .gitignore from git directories.

Release 24.11.2

Fixes #450
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working copy_tree Copying trees to build dirs
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants