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

rustc silently ignores failures in dsymutil #78770

Closed
gparker42 opened this issue Nov 5, 2020 · 2 comments · Fixed by #79508
Closed

rustc silently ignores failures in dsymutil #78770

gparker42 opened this issue Nov 5, 2020 · 2 comments · Fixed by #79508
Assignees
Labels
A-debuginfo Area: Debugging information in compiled programs (DWARF, PDB, etc.) A-linkage Area: linking into static, shared libraries and binaries C-bug Category: This is a bug. E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue. O-macos Operating system: macOS T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@gparker42
Copy link

gparker42 commented Nov 5, 2020

On macOS rustc runs dsymutil to generate debug info files. This invocation incorrectly ignores dsymutil's output and exit status. rustc thus succeeds even if dsymutil fails or crashes.

Example: in #78657, dsymutil crashed and left behind a corrupt .dSYM file. rustc nevertheless succeeded, thereby confusing the user after the debugger ignored that bad debug info.

@gparker42 gparker42 added the C-bug Category: This is a bug. label Nov 5, 2020
@gparker42
Copy link
Author

rustc ignoring process::Output.status:

// compiler/rustc_codegen_ssa/src/back/link.rs:765
if let Err(e) = Command::new("dsymutil").arg(out_filename).output() {
    sess.fatal(&format!("failed to run dsymutil: {}", e))
}

@jonas-schievink jonas-schievink added A-debuginfo Area: Debugging information in compiled programs (DWARF, PDB, etc.) A-linkage Area: linking into static, shared libraries and binaries O-macos Operating system: macOS T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Nov 5, 2020
@jyn514 jyn514 added the E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue. label Nov 5, 2020
@jryans
Copy link
Contributor

jryans commented Nov 26, 2020

@rustbot claim

GuillaumeGomez added a commit to GuillaumeGomez/rust that referenced this issue Dec 1, 2020
Warn if `dsymutil` returns an error code

This checks the error code returned by `dsymutil` and warns if it failed. It
also provides the stdout and stderr logs from `dsymutil`, similar to the native
linker step.

I tried to think of ways to test this change, but so far I haven't found a good way, as you'd likely need to inject some nonsensical args into `dsymutil` to induce failure, which feels too artificial to me. Also, rust-lang#79361 suggests Rust is on the verge of disabling `dsymutil` by default, so perhaps it's okay for this change to be untested. In any case, I'm happy to add a test if someone sees a good approach.

Fixes rust-lang#78770
GuillaumeGomez added a commit to GuillaumeGomez/rust that referenced this issue Dec 1, 2020
Warn if `dsymutil` returns an error code

This checks the error code returned by `dsymutil` and warns if it failed. It
also provides the stdout and stderr logs from `dsymutil`, similar to the native
linker step.

I tried to think of ways to test this change, but so far I haven't found a good way, as you'd likely need to inject some nonsensical args into `dsymutil` to induce failure, which feels too artificial to me. Also, rust-lang#79361 suggests Rust is on the verge of disabling `dsymutil` by default, so perhaps it's okay for this change to be untested. In any case, I'm happy to add a test if someone sees a good approach.

Fixes rust-lang#78770
@bors bors closed this as completed in 4ed9083 Dec 2, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-debuginfo Area: Debugging information in compiled programs (DWARF, PDB, etc.) A-linkage Area: linking into static, shared libraries and binaries C-bug Category: This is a bug. E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue. O-macos Operating system: macOS T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants