Skip to content

fix: Linux deb updater temp file deleted before dpkg install#55

Merged
MaxMB15 merged 2 commits into
mainfrom
feature/fix-linux-egl-crash
Apr 6, 2026
Merged

fix: Linux deb updater temp file deleted before dpkg install#55
MaxMB15 merged 2 commits into
mainfrom
feature/fix-linux-egl-crash

Conversation

@MaxMB15

@MaxMB15 MaxMB15 commented Apr 6, 2026

Copy link
Copy Markdown
Owner

NamedTempFile::into_file() consumes the handle and deletes the file from disk. dpkg then fails with "No such file or directory". Use keep() instead to persist the file, and clean it up manually after.

Also fix compiler warning: cast function pointer via *const () first.

NamedTempFile::into_file() consumes the handle and deletes the file
from disk. dpkg then fails with "No such file or directory". Use
keep() instead to persist the file, and clean it up manually after.

Also fix compiler warning: cast function pointer via *const () first.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings April 6, 2026 10:58

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes the Linux deb/rpm self-update flow in the Tauri backend by ensuring the downloaded package temp file remains present on disk long enough for dpkg/rpm to read it, and addresses a Rust compiler warning related to function-pointer casting in the Linux crash handler.

Changes:

  • Persist updater temp file on disk using NamedTempFile::keep() so dpkg/rpm can install from the filesystem path.
  • Manually delete the updater temp file after installation completes.
  • Adjust SIG handler function-pointer cast to avoid the warning by casting via *const () first.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
apps/desktop/src-tauri/src/lib.rs Adjusts Linux crash-handler sigaction assignment to avoid a function-pointer cast warning.
apps/desktop/src-tauri/src/commands.rs Changes Linux package update download temp-file handling to persist on disk for dpkg/rpm, with manual cleanup.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread apps/desktop/src-tauri/src/commands.rs Outdated
Comment on lines +1242 to +1244
// keep() persists the file on disk (disables auto-delete) so dpkg/rpm can access it by path.
let (std_file, tmp_path) = temp_file.keep().map_err(|e| format!("Failed to persist temp file: {e}"))?;
let mut file = tokio::fs::File::from_std(std_file);

Copilot AI Apr 6, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After switching to temp_file.keep(), the temp package file will persist on disk for any early-return error after this point (download stream error, write/flush error, pkexec spawn failure), because the cleanup only happens after output() completes. Consider adding a scope guard / TempPath-style RAII cleanup so the file is removed on all error paths, and only optionally retained for debugging when installation fails.

Copilot uses AI. Check for mistakes.
Use into_parts() to get a TempPath (RAII auto-delete on drop) instead
of keep(). The file is cleaned up on download errors, write errors,
and install failures — not just the success path.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@MaxMB15 MaxMB15 merged commit 6f3300f into main Apr 6, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants