Without an absolute HOME the earlier data layout could not be checked,
so a first-launch or install owner record was written anyway and that
data was migrated to the new owner later. Both now refuse instead.
Uninstall keeps an owner record while data exists in either layout, or
while it cannot tell. Launch tests use a private HOME, and the test
data-home cleanup never removes the running process's own.
App data in the earlier layout, <home>/.local/share/weft/apps/<id>/data,
is migrated to the app data directory after the owner check, so a
trusted package from another store could be recorded as owner on its
first launch and then receive that data. Both layouts now count as
existing data, in weft-appd and in weft-pack install, so unowned data
is only given away with --claim-data. The refusal says how to claim
it. Stale test data homes are removed only when their process has
exited, and the app-data check records the owner of the data it seeds.
weft-appd trusted an installed directory as installed, so content
changed after installation, or signed by a key since removed from the
trust store, still ran with the owner's app data. Before anything
starts, a package recorded as a publisher's must carry that
publisher's valid signature over its current content, with the key
still trusted; a package with no record must be signed by a trusted
key; development content, recorded by weft-pack install --dev, runs
unverified. Failures are refused with code 403.
The desktop checks trust the demo key, and the confinement check,
whose package deliberately holds a link, records it as development
content.
weft-pack treated any top-level data directory in a package as app
data from the earlier layout, in every store and for every app: a
package shipping data/ lost that content to the app data directory on
uninstall and could then no longer be uninstalled. Data is now moved
only from ~/.local/share/weft/apps/<id>/data, the only place earlier
versions wrote it, and only for packages declaring an app-data
capability; packages may no longer contain a top-level data entry.
The move left an empty package directory behind, which then blocked
weft-pack install although nothing was listed; an emptied package
directory is now removed, and install accepts an empty leftover. The
rename uses RENAME_NOREPLACE, so a target created after the check is
reported as a conflict instead of being replaced, and a move across
filesystems is refused with a message naming both locations instead of
a bare OS error. Directories moved by weft-pack are made private too,
and a symbolic link at the target is refused rather than followed.
The system UI now shows launch refusals, which it only logged, and the
weft-appd unit may write under ~/.local/share/weft, which
ProtectSystem=strict made read-only. check_app_data.py also types into
Notes after the move and requires the save to reach the moved file, and
checks that no empty package directory remains.
App data lived in ~/.local/share/weft/apps/<id>/data, inside the user
package store under the installed package directory. Uninstalling a
package deleted its data, and launching a package installed elsewhere
created that directory, after which installing the package for the user
failed because its directory already existed.
App data now lives in $XDG_DATA_HOME/weft/app-data/<id>, one shared
rule in weft_ipc_types::package, and is made private (0700) on every
launch. Data in the earlier location is moved there in one rename on the
first launch with an app-data capability, and by weft-pack before it
uninstalls a package or installs over a directory holding only data. If
both locations hold data, nothing is moved: the launch is refused with
409 and weft-pack stops, so neither copy is lost or merged.
tests/frame/check_app_data.py launches the Notes demo on the nested
desktop with notes in the earlier location and checks that they arrive
byte for byte (including a literal backslash sequence and non-ASCII
text), that the old directory is gone, that the new one is 0700 and that
a second copy makes the next launch fail with 409 without changing
either. The weft-pack tests that change the environment now share a lock.