Skip to content

remap libstd paths in backtraces for test crates #85463

Description

@jonas-schievink

I just got this backtrace when running RUST_BACKTRACE=1 cargo test on salsa-rs/salsa@bb4b42a:

thread 'frozen::in_par_get_set_cancelation' panicked at 'called `Result::unwrap()` on an `Err` value: Any { .. }', tests/parallel/frozen.rs:64:33
stack backtrace:
   0: rust_begin_unwind
             at /rustc/881c1ac408d93bb7adaa3a51dabab9266e82eee8/library/std/src/panicking.rs:493:5
   1: core::panicking::panic_fmt
             at /rustc/881c1ac408d93bb7adaa3a51dabab9266e82eee8/library/core/src/panicking.rs:92:14
   2: core::result::unwrap_failed
             at /rustc/881c1ac408d93bb7adaa3a51dabab9266e82eee8/library/core/src/result.rs:1355:5
   3: core::result::Result<T,E>::unwrap
             at /home/jonas/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/result.rs:1037:23
   4: parallel::frozen::in_par_get_set_cancelation
             at ./tests/parallel/frozen.rs:64:18
   5: parallel::frozen::in_par_get_set_cancelation::{{closure}}
             at ./tests/parallel/frozen.rs:13:1
   6: core::ops::function::FnOnce::call_once
             at /home/jonas/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ops/function.rs:227:5
   7: core::ops::function::FnOnce::call_once
             at /rustc/881c1ac408d93bb7adaa3a51dabab9266e82eee8/library/core/src/ops/function.rs:227:5

The remapping from /rustc/... paths to the rust-src component only seems to kick in once here, but I expected it to always work (since the component is installed). Frames 6 and 7 also point to the exact same location, but path remapping still failed for one of them.

Activity

  1. jyn514 commented on May 19, 2021

    @jyn514
    Member

    @jonas-schievink what version of rustc is this?

  2. jonas-schievink commented on May 19, 2021

    @jonas-schievink
    ContributorAuthor

    This is on rustc 1.54.0-nightly (881c1ac40 2021-05-08)

  3. jyn514 commented on May 19, 2021

    @jyn514
    Member

    Can you try with latest nightly? #83813 was merged recently and may have fixed this.

  4. jonas-schievink commented on May 19, 2021

    @jonas-schievink
    ContributorAuthor

    The most recent nightly seems to work even less:

    thread 'frozen::in_par_get_set_cancelation' panicked at 'called `Result::unwrap()` on an `Err` value: Any { .. }', tests/parallel/frozen.rs:64:33
    stack backtrace:
       0: rust_begin_unwind
                 at /rustc/4e3e6db011c5b482d2bef8ba02274657f93b5e0d/library/std/src/panicking.rs:515:5
       1: core::panicking::panic_fmt
                 at /rustc/4e3e6db011c5b482d2bef8ba02274657f93b5e0d/library/core/src/panicking.rs:92:14
       2: core::result::unwrap_failed
                 at /rustc/4e3e6db011c5b482d2bef8ba02274657f93b5e0d/library/core/src/result.rs:1355:5
       3: core::result::Result<T,E>::unwrap
                 at /rustc/4e3e6db011c5b482d2bef8ba02274657f93b5e0d/library/core/src/result.rs:1037:23
       4: parallel::frozen::in_par_get_set_cancelation
                 at ./tests/parallel/frozen.rs:64:18
       5: parallel::frozen::in_par_get_set_cancelation::{{closure}}
                 at ./tests/parallel/frozen.rs:13:1
       6: core::ops::function::FnOnce::call_once
                 at /rustc/4e3e6db011c5b482d2bef8ba02274657f93b5e0d/library/core/src/ops/function.rs:227:5
       7: core::ops::function::FnOnce::call_once
                 at /rustc/4e3e6db011c5b482d2bef8ba02274657f93b5e0d/library/core/src/ops/function.rs:227:5
    
  5. jyn514 commented on May 19, 2021

    @jyn514
    Member

    @jonas-schievink what do you mean? Those look correctly remapped to /rustc/hash to me, were you expecting something else?

  6. jyn514 commented on May 19, 2021

    @jyn514
    Member

    Oh I see, you want it to not remap and use the local path.

  7. changed the title [-]Path remapping in backtraces is broken[/-] [+]Don't remap libstd paths in backtraces for test crates[/+] on May 19, 2021
  8. added
    C-enhancementCategory: An issue proposing an enhancement or a PR with one.
    and removed
    C-bugCategory: This is a bug.
    on May 19, 2021
  9. jyn514 commented on May 19, 2021

    @jyn514
    Member

    Note that people have requested the opposite behavior in the past, but it seems reasonable to do this only for tests: #82188

  10. jonas-schievink commented on May 19, 2021

    @jonas-schievink
    ContributorAuthor

    The /rustc/<hash> path is the non-remapped path. I have the rust-src component installed, so they should be remapped to point there. (my mistake, the terminology used here wasn't clear to me)

  11. jyn514 commented on May 19, 2021

    @jyn514
    Member
  12. changed the title [-]Don't remap libstd paths in backtraces for test crates[/-] [+]remap libstd paths in backtraces for test crates[/+] on May 19, 2021
  13. 4 remaining items

  14. jyn514 commented on May 19, 2021

    @jyn514
    Member

    I guess as an alternative libtest could read a SYSROOT environment variable set by cargo, but that seems kind of hacky.

  15. cbeuw commented on May 19, 2021

    @cbeuw
    Contributor

    @jyn514 I'm in the middle of writing an RFC for Cargo that adds a profile setting called trim-path, which is basically an implementation of #40552 (sanitising every potential absolute paths, like paths to Cargo registry) and is enabled by default for release builds.

    Prehaps we could make the emission of virtual vs real sysroot paths also dependant on that? It seems a logical thing to do if trim-path gets added. This way both test and debug builds will have real paths embedded by default, and can be overriden manually if the user wishes.

  16. cbeuw commented on May 25, 2021

    @cbeuw
    Contributor
  17. added 3 commits that reference this issue on Dec 13, 2023
    8c9a219
    de0c2d5
    a05bc27
  18. added 3 commits that reference this issue on Sep 25, 2024
    43247de
    aa7aafc
    29cb988
  19. added a commit that references this issue on Sep 26, 2024
    0601ca8
  20. added a commit that references this issue on Sep 27, 2024
    b8179ef
  21. added 3 commits that reference this issue on Sep 27, 2024
    c2c35d6
    cde36fb
    1d9162b
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-reproducibilityArea: Reproducible / deterministic buildsC-enhancementCategory: An issue proposing an enhancement or a PR with one.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions