Fix chromium backend icon write failing with ENOENT #1

Merged
shocklateboy92 merged 1 commits from fix/chromium-icon-tempdir-drop into master 2026-05-25 14:05:50 +02:00
shocklateboy92 commented 2026-05-19 03:45:51 +02:00 (Migrated from github.com)

Summary

deskify build --backend chromium currently fails for every invocation with:

Error: Failed to write RGBA PNG icon to /tmp/.tmpXXXXXX/icon.png

Caused by:
    No such file or directory (os error 2)

The chromium branch in execute_build creates its temp directory with
tempdir()?.path().join("icon.png"). The TempDir returned by tempdir()
is unbound and so dropped at the end of that statement, and its Drop impl
removes the directory — before fetch_or_create_icon ever tries to write
into it.

Bind the TempDir to a local (let dir = tempdir()?;) so it lives until
the icon has been written and copied to its final install location. This
mirrors what the tauri branch a few lines above already does correctly.

Type of Change

  • Fix

What Was Tested

  • cargo fmt --check
  • cargo clippy --all-targets --all-features -- -D warnings
  • cargo test (37 passed)
  • cargo check
  • Manual smoke test: deskify build --url https://example.com --name "Example" --backend chromium — fails on master with the ENOENT above, succeeds on this branch and installs a working .desktop entry.

Behavior / Risk Notes

  • Tiny change, two lines, scoped to the chromium branch of execute_build.
  • No public API or config schema changes.
  • The tauri backend is unaffected (it already does this correctly).
  • No new test added: the bug is a Drop-timing issue inside a match arm of execute_build, and exercising it in a unit test would require refactoring that arm out. Felt out of proportion for a 2-line fix where symmetry with the adjacent tauri branch is the safeguard. Happy to add one if you'd prefer.

Screenshots (if relevant)

N/A — no UI changes.

## Summary `deskify build --backend chromium` currently fails for every invocation with: ``` Error: Failed to write RGBA PNG icon to /tmp/.tmpXXXXXX/icon.png Caused by: No such file or directory (os error 2) ``` The chromium branch in `execute_build` creates its temp directory with `tempdir()?.path().join("icon.png")`. The `TempDir` returned by `tempdir()` is unbound and so dropped at the end of that statement, and its `Drop` impl removes the directory — before `fetch_or_create_icon` ever tries to write into it. Bind the `TempDir` to a local (`let dir = tempdir()?;`) so it lives until the icon has been written and copied to its final install location. This mirrors what the tauri branch a few lines above already does correctly. ## Type of Change - [x] Fix ## What Was Tested - [x] `cargo fmt --check` - [x] `cargo clippy --all-targets --all-features -- -D warnings` - [x] `cargo test` (37 passed) - [x] `cargo check` - [x] Manual smoke test: `deskify build --url https://example.com --name "Example" --backend chromium` — fails on master with the ENOENT above, succeeds on this branch and installs a working `.desktop` entry. ## Behavior / Risk Notes - Tiny change, two lines, scoped to the chromium branch of `execute_build`. - No public API or config schema changes. - The tauri backend is unaffected (it already does this correctly). - No new test added: the bug is a Drop-timing issue inside a `match` arm of `execute_build`, and exercising it in a unit test would require refactoring that arm out. Felt out of proportion for a 2-line fix where symmetry with the adjacent tauri branch is the safeguard. Happy to add one if you'd prefer. ## Screenshots (if relevant) N/A — no UI changes.
Sign in to join this conversation.