fix(gui): create the state dir before the tray and app use it (B194)

On a fresh install only the daemon and the CLI created
~/.local/state/proton-drive-linux. The app starts the tray before the
first sign-in, so the tray failed to bind its single-instance socket and
exited, and the Takeout page could not remember staged archives (#29).

- gui: pdfs-tray and pdfs-app call AppDirs::ensure at start, which also
  makes the directories owner-only
- docs: B194 in the bug ledger, changelog entry
This commit is contained in:
nvrl committed 2026-10-08 10:25:04 +02:00
1 parent 5bfae0fee1
commit c7fc85e943
4 files changed
+41 -1

No files matched your search

+5
View File
@@ -303,6 +303,11 @@ fn build_window(app: &adw::Application) {
return;
}
};
// On a fresh install the daemon has not run yet to make these, and the
// Takeout page keeps its staged archives in the state dir (B194).
if let Err(e) = dirs.ensure() {
tracing::warn!("cannot create the app's directories: {e}");
}
let stack = adw::ViewStack::new();
let (login_page, login_widgets) = build_login_page();
+4
View File
@@ -485,6 +485,10 @@ fn main() -> Result<()> {
return Ok(());
}
// The socket lives in the state dir, which nothing has made yet when the app
// starts the tray on a fresh install (B194).
dirs.ensure().context("create the app's directories")?;
// Ensure only one instance of the tray runs.
let tray_sock = dirs.tray_socket();
if std::os::unix::net::UnixStream::connect(&tray_sock).is_ok() {
+26 -1
View File
@@ -47,7 +47,7 @@ original wording.
it in the index in the same change.
```markdown
### B194 — What the user sees, in one line
### B195 — What the user sees, in one line
**Status:** Open
**Found:** 2026-10-06, how it was found
@@ -214,6 +214,7 @@ a live account since.
| Entry | Title |
|---|---|
| [B194](#b194--on-a-fresh-install-the-tray-exits-and-the-takeout-page-cannot-remember-its-archives) | On a fresh install the tray exits and the Takeout page cannot remember its archives |
| [B192](#b192--a-new-file-closed-empty-reaches-drive-only-half-a-minute-later) | A new file closed empty reaches Drive only half a minute later |
| [B181](#b181--the-app-shows-a-queued-edit-kept-as-a-conflict-copy-in-english) | The app shows a queued edit kept as a conflict copy in English |
| [B180](#b180--a-stop-waits-10-s-for-a-drain-worker-that-slept-through-it) | A stop waits 10 s for a drain worker that slept through it |
@@ -296,6 +297,30 @@ a live account since.
Newest first.
### B194 — On a fresh install the tray exits and the Takeout page cannot remember its archives
**Status:** Fixed.
**Found:** 2026-10-07, in the log of [#29](https://github.com/narrrl/proton-drive-linux/issues/29):
`failed to bind tray single-instance socket: No such file or directory` and
`cannot remember staged Takeout archives: No such file or directory`.
**Where:** `crates/pdfs-gui/src/main.rs`, `build_window` in `crates/pdfs-gui/src/app/main.rs`
**Repro:** Start `pdfs-app` with no `~/.local/state/proton-drive-linux`, as on a fresh install. The
tray is gone, and staging a Takeout archive logs the warning.
**Cause.** Both write to the state directory, and only the daemon and the CLI made it
(`AppDirs::ensure`). The app starts the tray before the first sign-in, so before the daemon has
ever run.
**Fix.** `pdfs-tray` and `pdfs-app` call `AppDirs::ensure` at start, which also makes the
directories owner-only (B6).
**Verified:** 2026-10-08, `pdfs-tray` with `XDG_STATE_HOME`, `XDG_CONFIG_HOME` and
`XDG_CACHE_HOME` pointing at an empty directory. It exited with the error before the fix, and
afterwards ran with `tray.sock` in a `0700` state directory.
---
### B193 — Deleting a file whose create failed can trash a file of the user's on Drive
**Status:** Fixed (unverified).
+6
View File
@@ -11,6 +11,12 @@ scratch (user data in `staging/` and `recovery/` is never touched by this).
## [Unreleased]
### Fixed
- **On a fresh install the tray icon did not start.** The tray and the app now create their state
directory themselves instead of waiting for the service to do it. This also lets the Takeout
page remember staged archives before the first mount.
([#29](https://github.com/narrrl/proton-drive-linux/issues/29))
## [3.1.1] — 2026-10-07
Schema: **42**, unchanged.