Skip to content

Image cache: reach webOS 3.4's one writable directory, sized to its free space - #667

Merged
GLinnik21 merged 4 commits into
plxnative:mainfrom
selfhealer-png:pr/webos3-imgcache
Oct 14, 2026
Merged

GLinnik21 merged 4 commits into
plxnative:mainfrom
selfhealer-png:pr/webos3-imgcache

Conversation

@selfhealer-png

Copy link
Copy Markdown
Contributor

Image cache: reach webOS 3.4's one writable directory, sized to its free space

On a webOS 3.4.3 set the poster disk cache was off entirely:

imgcache: no writable directory; disk cache unavailable

so every poster was fetched and decoded again on every view, across launches as well as within one.

Why

paths::image_cache_candidates tries /media/developer/<id>-imgcache, then
/media/internal/.<id>-imgcache, then the app directory. On this set (55UH650V, webOS 3.4.3,
Developer Mode), as the Developer Mode user, from SSH:

Directory Result
/media/developer Permission denied (root-owned, drwxrwxr-x root root)
/media/internal Read-only file system
/media/developer/temp writable, persistent ext4, mounted inside the app's jail
/tmp writable, but tmpfs

/media/developer/temp is drwxrwxrwx root root on the /media partition (mmcblk0p52), and
the app's jail mounts /media/developer read-write, so the app reaches it too.

The change

  1. A new candidate, /media/developer/temp/<id>-imgcache, after the two existing ones and
    before the app directory. Sets where an earlier candidate is writable are unchanged.
  2. A free-space cap. That partition also holds installed apps: 636 MB, with 76.5 MB free
    on this set. The fixed 128 MiB ceiling would have filled it and risked app installs and updates,
    so the byte cap is now min(128 MiB, (free + the cache's own bytes) / 2) for whichever root
    is chosen, measured with statvfs once at startup. Below 8 MiB of spare the disk tier stays
    off. On a roomy filesystem the result is the same 128 MiB as before. The startup line reports
    it as cap=.
  3. Tests for the cap rule (this set's numbers, a roomy disk, the cache's own bytes counting as
    spare, too little to bother, unknown free space, a small configured limit honoured) and for
    free_bytes on a test directory. docs/image-cache.md and the paths.rs doc say both.

On the set

The cache came up on the new directory and grew across launches over two days:

imgcache: /media/developer/temp/com.beb.plxnative.debug-imgcache entries=93  bytes=3076122 cap=39979021
imgcache: /media/developer/temp/com.beb.plxnative.debug-imgcache entries=183 bytes=5953801 cap=39881860
imgcache: /media/developer/temp/com.beb.plxnative.debug-imgcache entries=216 bytes=7178055 cap=39828387
imgcache: /media/developer/temp/com.beb.plxnative.debug-imgcache entries=242 bytes=7958653 cap=39800894

Things I could not establish

  • Who else can read it. The cache directory is created with default permissions inside a
    world-writable parent. Other users cannot write into it, but other processes could read the
    cached posters, which reveal what is in the library. I'd be happy to have probe_dir create the
    directory 0700 (for this candidate, or all of them) if you'd prefer. I left it alone so this
    PR only changes where and how much.
  • Other 3.x firmwares. Only 3.4.3 is measured. 3.9.x may have a writable /media/developer
    already, in which case nothing changes there.

selfhealer-png and others added 4 commits October 13, 2026 20:44
…ree space

On a 2016 set running webOS 3.4.3 every candidate failed
("imgcache: no writable directory"): /media/developer is root-owned and
/media/internal read-only, so every poster was fetched again on every
view. /media/developer/temp is writable there, persistent, and inside
the app's jail; it is now the third candidate.

That directory shares the partition installed apps live on (76.5 MB
free of 636 MB), so the byte cap is now the fixed 128 MiB clamped to half
of what the filesystem can spare (free space plus the cache's own
files), and the disk tier stays off below 8 MiB of spare. The startup
log line reports the cap.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: selfhealer-png <[email protected]>
check-list-caps (plxnative#605) requires a section for every cap-shaped site.
MIN_CAP is the spare-disk floor below which the poster cache stays off;
a work bound like its MAX_* siblings.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: selfhealer-png <[email protected]>
/media/developer/temp is mode 777, so a cache directory made there with the default mode let any
other process read the cached posters. The new candidate (and only it) is now created 0700; an
existing directory we own is tightened to 0700, and a foreign-owned directory or a symlink at the
name is refused and the next candidate is tried. The mkdir/O_NOFOLLOW/fchmod sequence follows
paths::share_runtime_dir. Tests were written first and failed with mode 0755 against 0700.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
@GLinnik21
GLinnik21 merged commit 8455275 into plxnative:main Oct 14, 2026
11 checks passed
@GLinnik21

Copy link
Copy Markdown
Collaborator

Merged, thank you @selfhealer-png! Great work.

GLinnik21 added a commit that referenced this pull request Oct 22, 2026
* Release notes and audit for v0.9.0

Action-required evaluation (README trigger list, read from the PRs, grep not run on a built tree): no hits that need a reader action. Launch links (#853) add an inbound surface (any app that can launch apps), stated in What's new; the 3.4 image cache writes to /media/developer/temp (#667); crash/error reports gain fixed-value fields with POLICY_VERSION unchanged (#632), stated under Changed; Watchlist and PMS notifications use hosts the app already reaches.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* Release notes v0.9.0: coverage and accuracy pass

Note: correct the Collections surfaces (no TYPE menu; collection shelf
headings live on Home and a library's Recommended page), the Watchlist
hold-menu rows, the launch-link sign-in behaviour and platform-release
numbering, the notification-feed sentence and the per-profile settings
list (no stale "nine"). Add #832, #808, #750/#762, #709 (#628), #641,
#647, #793, #871, #877 (#679), #876 and the key-press frame work;
credit RichiL10 and Shakil Choudhury. #862 moves from Known issues to
the webOS 3.x lines as fixed by #578; the 3.9.3 source-build report
(#700) is kept in Compatibility. Compatibility links reports, not
reporters' profiles.

Audit: #862 provenance (attributed usage-report reading, no counts),
contributor list wording.

Action-required section: not owed. The README grep over
v0.8.0..origin/main (rust-modules/src src ci) hits only CI tooling,
test-only loopback listeners and fixture tokens, and the dev-only
/tmp/plxnative-trackmemory trigger; the audit's PR-by-PR reading in
"Deliberately not done" stands.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* Release audit v0.9.0: name the toolchain by its pin file, not its version

Co-Authored-By: Claude Opus 5.5 <[email protected]>

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>
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