Compare commits

...

1 Commits

Author SHA1 Message Date
gustav-fff 36a340985a fix(log): create log file when arming SIGSEGV handler fd
sigsegv::set_log_fd() runs before init_tracing opens/creates the
writer file. Its previous OpenOptions used append(true) with no
create(true), so on the first-ever session the file did not yet
exist, the open failed silently, and LOG_FD stayed -1. When a
segfault later fired the banner was written to fd 2 only; nvim
discards stderr, and nothing ever hit the log — leaving users
with only the terminal banner and no attachable crash section.

Refs #641.
2026-07-02 15:13:53 -07:00
+8 -1
View File
@@ -34,8 +34,15 @@ mod sigsegv {
static LOG_FD: AtomicI32 = AtomicI32::new(-1);
// Must `create(true)` — this runs before init_tracing opens/creates the
// writer file, so an append-only open on a non-existent path silently
// fails, LOG_FD stays -1, and the SIGSEGV banner never reaches the log.
pub fn set_log_fd(path: &Path) {
if let Ok(file) = std::fs::OpenOptions::new().append(true).open(path) {
if let Ok(file) = std::fs::OpenOptions::new()
.create(true)
.append(true)
.open(path)
{
let prev = LOG_FD.swap(file.into_raw_fd(), Ordering::Relaxed);
if prev >= 0 {
unsafe { libc::close(prev) };