Skip to content

RUST_BACKTRACE=full can't find source files if the running application changes its working directory #2

@yaahc

Description

@yaahc

This version will print source lines

    panic!();
    std::env::set_current_dir(git_dir)?;

this version will hit the subsequent line in color-backtrace/src/lib.rs and skip printing all the src lines.

    std::env::set_current_dir(git_dir)?;
    panic!();
214             Err(ref e) if e.kind() == ErrorKind::NotFound => return Ok(()),

The filenames in my binary all use relative paths, I noticed that in your screenshot it seems to use absolute paths.

I imagine the fix is as simple as generating the rust binaries with absolute paths in the debug info, but I have no idea how to force it to compile that way. Either that or store the crate root somewhere in the binary and use that during filename resolution rather than expecting it to work relative to the current directory.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions