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

ICE when using \\.\NUL as the input filename on Windows #128681

Closed
ChrisDenton opened this issue Aug 5, 2024 · 1 comment · Fixed by #128710
Closed

ICE when using \\.\NUL as the input filename on Windows #128681

ChrisDenton opened this issue Aug 5, 2024 · 1 comment · Fixed by #128710
Labels
C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ O-windows Operating system: Windows P-low Low priority T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@ChrisDenton
Copy link
Member

Code

On a Windows machine, run:

rustc \\.\NUL

Meta

rustc --version --verbose:

rustc 1.82.0-nightly (176e54520 2024-08-04)
binary: rustc
commit-hash: 176e5452095444815207be02c16de0b1487a1b53
commit-date: 2024-08-04
host: x86_64-pc-windows-msvc
release: 1.82.0-nightly
LLVM version: 19.1.0

Error output

thread 'rustc' panicked at compiler\rustc_session\src\config.rs:842:57:
called `Option::unwrap()` on a `None` value

Which is here:

Input::File(ref ifile) => ifile.file_stem().unwrap().to_str().unwrap(),

Specifically the file_stem().unwrap() panics. The \\.\NUL device is pretty weird as it's a device in its own right that you can read/write to but also a kind of root directory (you can do \\.\NUL\path\to\rust.rs) and calling parent() on \\.\NUL should return None. It doesn't quite fit with std's model of paths.

Backtrace

thread 'rustc' panicked at compiler\rustc_session\src\config.rs:842:57:
called `Option::unwrap()` on a `None` value
stack backtrace:
   0:     0x7ffd5681d903 - std::backtrace_rs::backtrace::dbghelp64::trace
                               at /rustc/176e5452095444815207be02c16de0b1487a1b53\library/std\src\..\..\backtrace\src\backtrace\dbghelp64.rs:91
   1:     0x7ffd5681d903 - std::backtrace_rs::backtrace::trace_unsynchronized
                               at /rustc/176e5452095444815207be02c16de0b1487a1b53\library/std\src\..\..\backtrace\src\backtrace\mod.rs:66
   2:     0x7ffd5681d903 - std::backtrace::Backtrace::create
                               at /rustc/176e5452095444815207be02c16de0b1487a1b53\library/std\src\backtrace.rs:331
   3:     0x7ffd5681d84a - std::backtrace::Backtrace::force_capture
                               at /rustc/176e5452095444815207be02c16de0b1487a1b53\library/std\src\backtrace.rs:312
   4:     0x7ffceb7fcef9 - memchr
   5:     0x7ffd5683871b - alloc::boxed::impl$50::call
                               at /rustc/176e5452095444815207be02c16de0b1487a1b53\library/alloc\src\boxed.rs:2164
   6:     0x7ffd5683871b - std::panicking::rust_panic_with_hook
                               at /rustc/176e5452095444815207be02c16de0b1487a1b53\library/std\src\panicking.rs:805
   7:     0x7ffd568384ef - std::panicking::begin_panic_handler::closure$0
                               at /rustc/176e5452095444815207be02c16de0b1487a1b53\library/std\src\panicking.rs:664
   8:     0x7ffd5683569f - std::sys::backtrace::__rust_end_short_backtrace<std::panicking::begin_panic_handler::closure_env$0,never$>
                               at /rustc/176e5452095444815207be02c16de0b1487a1b53\library/std\src\sys\backtrace.rs:170
   9:     0x7ffd56838136 - std::panicking::begin_panic_handler
                               at /rustc/176e5452095444815207be02c16de0b1487a1b53\library/std\src\panicking.rs:662
  10:     0x7ffd56890c94 - core::panicking::panic_fmt
                               at /rustc/176e5452095444815207be02c16de0b1487a1b53\library/core\src\panicking.rs:74
  11:     0x7ffd56890d3d - core::panicking::panic
                               at /rustc/176e5452095444815207be02c16de0b1487a1b53\library/core\src\panicking.rs:148
  12:     0x7ffd56890bfe - core::option::unwrap_failed
                               at /rustc/176e5452095444815207be02c16de0b1487a1b53\library/core\src\option.rs:2017
  13:     0x7ffcecea3774 - <rustc_session[2d2a655f635f0202]::config::Input>::filestem
  14:     0x7ffce7350e81 - rustc_interface[386d7deb044bc41f]::util::build_output_filenames
  15:     0x7ffce73497ea - <rustc_interface[386d7deb044bc41f]::queries::Queries>::global_ctxt
  16:     0x7ffce7303523 - _wpgmptr
  17:     0x7ffce72ff27f - _wpgmptr
  18:     0x7ffce730cf5b - _wpgmptr
  19:     0x7ffd56849acd - alloc::boxed::impl$48::call_once
                               at /rustc/176e5452095444815207be02c16de0b1487a1b53\library/alloc\src\boxed.rs:2150
  20:     0x7ffd56849acd - alloc::boxed::impl$48::call_once
                               at /rustc/176e5452095444815207be02c16de0b1487a1b53\library/alloc\src\boxed.rs:2150
  21:     0x7ffd56849acd - std::sys::pal::windows::thread::impl$0::new::thread_start
                               at /rustc/176e5452095444815207be02c16de0b1487a1b53\library/std\src\sys\pal\windows\thread.rs:55
  22:     0x7ffda697257d - BaseThreadInitThunk
  23:     0x7ffda7caaf28 - RtlUserThreadStart


rustc version: 1.82.0-nightly (176e54520 2024-08-04)
platform: x86_64-pc-windows-msvc

@ChrisDenton ChrisDenton added I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. C-bug Category: This is a bug. labels Aug 5, 2024
@rustbot rustbot added the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Aug 5, 2024
@ChrisDenton
Copy link
Member Author

To be clear, this is a strange thing to be doing so I wouldn't consider this a high priority or anything.

@jieyouxu jieyouxu added O-windows Operating system: Windows and removed needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. labels Aug 5, 2024
@Noratrieb Noratrieb added the P-low Low priority label Aug 5, 2024
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this issue Aug 6, 2024
Don't ICE when getting an input file name's stem fails

Fixes rust-lang#128681

The file stem is only used as a user-friendly prefix on intermediary files. While nice to have, it's not the end of the world if it fails so there's no real reason to emit an error here. We can continue with a fixed name as we do when an anonymous string is used.
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this issue Aug 6, 2024
Don't ICE when getting an input file name's stem fails

Fixes rust-lang#128681

The file stem is only used as a user-friendly prefix on intermediary files. While nice to have, it's not the end of the world if it fails so there's no real reason to emit an error here. We can continue with a fixed name as we do when an anonymous string is used.
@bors bors closed this as completed in f9325b7 Aug 7, 2024
rust-timer added a commit to rust-lang-ci/rust that referenced this issue Aug 7, 2024
Rollup merge of rust-lang#128710 - ChrisDenton:null, r=jieyouxu

Don't ICE when getting an input file name's stem fails

Fixes rust-lang#128681

The file stem is only used as a user-friendly prefix on intermediary files. While nice to have, it's not the end of the world if it fails so there's no real reason to emit an error here. We can continue with a fixed name as we do when an anonymous string is used.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ O-windows Operating system: Windows P-low Low priority 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