feat(libkernel): carry chflags implementation #4379

Merged
MarcZX10 merged 4 commits from upstream-pr/4379 into main 2026-10-13 21:22:03 +00:00
MarcZX10 commented 2026-10-12 08:20:26 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-12T08:20:26Z.


What

Carries the chflags implementation from issue #3632. It validates the guest path, reports missing and unsupported flag errors, rejects SF_SNAPSHOT, and throws an explicit unsupported-host error when asked to set recognized BSD file flags that the host does not store.

PPSA99420 reaches the chflags import on current main now that its earlier stops have merged (issue #1578). This PR carries only chflags; the other calls from #3632 are separate changes.

Tested

  • Before this current-main rebase, Linux Release GCC 12.2 built guest_filesystem_tests; CTest guest_filesystem passed 1/1.
  • Conventions and git diff --check passed on that earlier head.
  • The current-main rebase has not been built or tested locally. CI/reviewer validation should rerun on this head.

Checklist

  • Based on current main; no open PR implements the same function
  • One topic: chflags
  • No comments in code except technical debt
  • No notes or investigation files added
  • Generic behavior, not title-specific
  • Depends on: none (the earlier prerequisite PRs have merged)
  • Unblocks: PPSA99420 #1578
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4826762631 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/4379). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-12T08:20:26Z. --- ### What Carries the `chflags` implementation from issue #3632. It validates the guest path, reports missing and unsupported flag errors, rejects `SF_SNAPSHOT`, and throws an explicit unsupported-host error when asked to set recognized BSD file flags that the host does not store. PPSA99420 reaches the `chflags` import on current `main` now that its earlier stops have merged (issue #1578). This PR carries only `chflags`; the other calls from #3632 are separate changes. ### Tested - Before this current-main rebase, Linux Release GCC 12.2 built `guest_filesystem_tests`; CTest `guest_filesystem` passed 1/1. - Conventions and `git diff --check` passed on that earlier head. - The current-main rebase has not been built or tested locally. CI/reviewer validation should rerun on this head. ### Checklist - [x] Based on current `main`; no open PR implements the same function - [x] One topic: `chflags` - [x] No comments in code except technical debt - [x] No notes or investigation files added - [x] Generic behavior, not title-specific - [x] Depends on: none (the earlier prerequisite PRs have merged) - [x] Unblocks: PPSA99420 #1578 - [x] AI-assisted: yes
github-actions[bot] commented 2026-10-12 08:30:59 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-12T08:30:59Z.


Progress report (0aa4cb1 → b6a10e9)

📈 System libraries: 88.16% (+0.01%, +1 implemented functions)

✅ 1 implemented
Library Name
libkernel chflags_nid_postfix
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6120618521 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/4379#issuecomment-6120618521). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-10-12T08:30:59Z. --- <!-- progress-report --> ### Progress report (0aa4cb1 → b6a10e9) 📈 **System libraries**: 88.16% (+0.01%, +1 implemented functions) <details> <summary>✅ 1 implemented</summary> | Library | Name | | - | - | | libkernel | `chflags_nid_postfix` | </details>
MarcZX10 commented 2026-10-12 08:41:54 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-12T08:41:54Z.


The PR description was corrected to use the template section headings (### What, ### Tested, ### Checklist) and now passes the local conventions checker. The current hosted conventions result reflects the earlier body. Posting this update to trigger a fresh PR check against the corrected description.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6120777628 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/4379#issuecomment-6120777628). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-12T08:41:54Z. --- The PR description was corrected to use the template section headings (`### What`, `### Tested`, `### Checklist`) and now passes the local conventions checker. The current hosted conventions result reflects the earlier body. Posting this update to trigger a fresh PR check against the corrected description.
reyani-dev commented 2026-10-12 09:03:23 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by reyani-dev on 2026-10-12T09:03:23Z.


Title path for this one, from a Windows run (catalog build, main e013f8c9 + #3980 + #3893 + #3781):

  • PS5MC (PPSA99420) stops at FAIL: unresolved ELF import ixrw0h2tWuI from libkernel.prx (chflags). With a chflags export added, its next stop is miQ1wVwSexE (getpriority, #4374).
  • The only call site (guest 0x3C9100A) is the bundled CPython's os.chflags (chflags($module, /, path, flags, follow_symlinks=True); the lchflags branch sits next to it). CPython's shutil.copystat calls os.chflags(dst, st.st_flags) when both exist, so any shutil.copy2/copytree in a Kodi add-on reaches it.
  • NativeStat zero-initialises FileStat (*sb = FileStat{};) and nothing sets st_flags, so that call is always chflags(path, 0). That's the path this PR answers with 0 after the lookup.
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6121099033 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/4379#issuecomment-6121099033). Originally posted by [reyani-dev](https://github.com/reyani-dev) on 2026-10-12T09:03:23Z. --- Title path for this one, from a Windows run (catalog build, `main` e013f8c9 + #3980 + #3893 + #3781): - PS5MC (PPSA99420) stops at `FAIL: unresolved ELF import ixrw0h2tWuI from libkernel.prx` (`chflags`). With a `chflags` export added, its next stop is `miQ1wVwSexE` (`getpriority`, #4374). - The only call site (guest `0x3C9100A`) is the bundled CPython's `os.chflags` (`chflags($module, /, path, flags, follow_symlinks=True)`; the `lchflags` branch sits next to it). CPython's `shutil.copystat` calls `os.chflags(dst, st.st_flags)` when both exist, so any `shutil.copy2`/`copytree` in a Kodi add-on reaches it. - `NativeStat` zero-initialises `FileStat` (`*sb = FileStat{};`) and nothing sets `st_flags`, so that call is always `chflags(path, 0)`. That's the path this PR answers with 0 after the lookup.
blawesom commented 2026-10-12 14:39:34 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by blawesom on 2026-10-12T14:39:34Z.


Rebase handoff — rebased onto current main, authorship unchanged.

One conflict in Stdio.cpp, resolved by keeping both sides: main's newer File::DuplicateFrom (the guest-socket descriptor duplication) and this PR's LookupError + chflags tables are independent additions at the same spot. TechnicalDebt.md unioned.

Verified on Linux (CachyOS, kernel 7.2.9, GCC 16.2.1, Ninja, Release, BUILD_TESTING=ON, AMD RX 9070 XT / RADV):

  • builds; tools/check_conventions.py --base origin/main passes
  • full suite: 955/955 passed

To pick it up:

git fetch https://github.com/blawesom/AnyPS5 rebase/4379
git checkout <your branch>
git merge --ff-only FETCH_HEAD

Head is fdfdc9435.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6126485809 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/4379#issuecomment-6126485809). Originally posted by [blawesom](https://github.com/blawesom) on 2026-10-12T14:39:34Z. --- **Rebase handoff** — rebased onto current `main`, authorship unchanged. One conflict in `Stdio.cpp`, resolved by keeping both sides: main's newer `File::DuplicateFrom` (the guest-socket descriptor duplication) and this PR's `LookupError` + chflags tables are independent additions at the same spot. `TechnicalDebt.md` unioned. Verified on Linux (CachyOS, kernel 7.2.9, GCC 16.2.1, Ninja, Release, `BUILD_TESTING=ON`, AMD RX 9070 XT / RADV): - builds; `tools/check_conventions.py --base origin/main` passes - **full suite: 955/955 passed** **To pick it up:** ``` git fetch https://github.com/blawesom/AnyPS5 rebase/4379 git checkout <your branch> git merge --ff-only FETCH_HEAD ``` Head is `fdfdc9435`.
oneandonlydean commented 2026-10-12 21:12:33 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-12T21:12:33Z.


The three pull requests this waited on are merged (#3980, #3893, #3781), so PPSA99420 reaches the chflags import on main now. It conflicts with main again: please rebase (the branch blawesom posted above resolves Stdio.cpp; the debt entry now goes into docs/dev/debt/), and I'll build and merge it.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6132695124 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/4379#issuecomment-6132695124). Originally posted by [oneandonlydean](https://github.com/oneandonlydean) on 2026-10-12T21:12:33Z. --- The three pull requests this waited on are merged (#3980, #3893, #3781), so PPSA99420 reaches the `chflags` import on `main` now. It conflicts with `main` again: please rebase (the branch blawesom posted above resolves `Stdio.cpp`; the debt entry now goes into `docs/dev/debt/`), and I'll build and merge it.
MarcZX10 commented 2026-10-13 07:13:34 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-13T07:13:34Z.


Thanks. The PS5MC report confirms the chflags import stop and its next getpriority stop. I see the rebased handoff branch and its Linux test results; the PR head itself still conflicts with main. I will update the PR branch from current main before requesting the build and merge review.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6140340071 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/4379#issuecomment-6140340071). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-13T07:13:34Z. --- Thanks. The PS5MC report confirms the chflags import stop and its next getpriority stop. I see the rebased handoff branch and its Linux test results; the PR head itself still conflicts with main. I will update the PR branch from current main before requesting the build and merge review.
MarcZX10 commented 2026-10-13 07:37:10 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-13T07:37:10Z.


Rebased onto current main and resolved the debt-file conflict by keeping main's entries and adding the chflags entry. The earlier dependencies (#3980, #3893 and #3781) are merged, so I removed them from the dependency list and recorded PPSA99420 (#1578) under Unblocks. The old Linux result predates this rebase; I have not rerun it, and the description now says that explicitly. This head is ready for the build/review you offered.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6140697111 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/4379#issuecomment-6140697111). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-13T07:37:10Z. --- Rebased onto current `main` and resolved the debt-file conflict by keeping main's entries and adding the `chflags` entry. The earlier dependencies (#3980, #3893 and #3781) are merged, so I removed them from the dependency list and recorded PPSA99420 (#1578) under `Unblocks`. The old Linux result predates this rebase; I have not rerun it, and the description now says that explicitly. This head is ready for the build/review you offered.
screamm commented 2026-10-13 10:42:07 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by screamm on 2026-10-13T10:42:07Z.


Windows validation with title evidence (Windows 11 Pro 26220, WinLibs MinGW-w64 GCC 15.2.0 r7, Ninja, Release, BUILD_TESTING=ON, full build including libs; base main 2a2a3dc6): 71fbc3ce merges cleanly but does not compile on current main: Stdio.cpp:308:22: error: redefinition of 'constexpr const int GUEST_EOPNOTSUPP', because main already has static constexpr int GUEST_EOPNOTSUPP = 45; since e99816e8 (#4391); the rebase only needs to drop the PR's copy (same value). With that one line removed: guest_filesystem 3/3; suite 688/689, the only failure being patched_libraries, which fails on main itself until #5025; conventions and git diff --check pass.

PS5MC (PPSA99420) relinked against that build: before, FAIL: unresolved ELF import ixrw0h2tWuI from libkernel.prx (chflags); after, FAIL: unresolved ELF import miQ1wVwSexE from libkernel.prx (getpriority, #4374). Stacked with #4374 and #4383 (plus a one-line test fix on #4383, see there) the title goes on to FAIL: unresolved ELF import d7nUj1LOdDU from libkernel.prx (clock_settime, the last commit of my #3632 branch).

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6143765922 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/4379#issuecomment-6143765922). Originally posted by [screamm](https://github.com/screamm) on 2026-10-13T10:42:07Z. --- Windows validation with title evidence (Windows 11 Pro 26220, WinLibs MinGW-w64 GCC 15.2.0 r7, Ninja, Release, `BUILD_TESTING=ON`, full build including `libs`; base `main` `2a2a3dc6`): `71fbc3ce` merges cleanly but does not compile on current `main`: `Stdio.cpp:308:22: error: redefinition of 'constexpr const int GUEST_EOPNOTSUPP'`, because `main` already has `static constexpr int GUEST_EOPNOTSUPP = 45;` since `e99816e8` (#4391); the rebase only needs to drop the PR's copy (same value). With that one line removed: `guest_filesystem` 3/3; suite 688/689, the only failure being `patched_libraries`, which fails on `main` itself until #5025; conventions and `git diff --check` pass. PS5MC (PPSA99420) relinked against that build: before, `FAIL: unresolved ELF import ixrw0h2tWuI from libkernel.prx` (chflags); after, `FAIL: unresolved ELF import miQ1wVwSexE from libkernel.prx` (getpriority, #4374). Stacked with #4374 and #4383 (plus a one-line test fix on #4383, see there) the title goes on to `FAIL: unresolved ELF import d7nUj1LOdDU from libkernel.prx` (`clock_settime`, the last commit of my #3632 branch).
p3n1cillin commented 2026-10-13 14:10:47 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by p3n1cillin on 2026-10-13T14:10:47Z.


Title run with this PR: Windows 11, MinGW GCC 15.2.0 (WinLibs), Release. Built on main 3faa9cb40 merged with this PR and the other open PRs that the catalog titles below need (#4377, #4379, #4374, #4383, #3798, #4863, #4105, my #5013/#5061/#5078/#5098/#5009 and the carries #5183/#5186, plus screamm's chroot branch from #3632); every title converted from its catalog release, eboot.bin kept in app0, 60 s runs.

  • PS5MC (PPSA99420): with this PR, #4374, #4383 and #5183 (clock_settime) it loads; tools/import_audit.py lists no absent import. It then needs #5184, #5185 and #5186 to get through Kodi's start-up, after which Kodi creates its GUI and runs 90 s.

Build problem at this head (71fbc3ce6): core/libs/prx/libkernel/File/src/Stdio.cpp defines static constexpr int GUEST_EOPNOTSUPP = 45; twice (lines 302 and 308), so GCC 15 stops with redefinition of 'constexpr const int GUEST_EOPNOTSUPP'. One of the two lines needs to go; I dropped line 308 locally for the run above.

AI-assisted (Claude Code).

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6147490391 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/4379#issuecomment-6147490391). Originally posted by [p3n1cillin](https://github.com/p3n1cillin) on 2026-10-13T14:10:47Z. --- Title run with this PR: Windows 11, MinGW GCC 15.2.0 (WinLibs), Release. Built on `main` `3faa9cb40` merged with this PR and the other open PRs that the catalog titles below need (#4377, #4379, #4374, #4383, #3798, #4863, #4105, my #5013/#5061/#5078/#5098/#5009 and the carries #5183/#5186, plus screamm's `chroot` branch from #3632); every title converted from its catalog release, `eboot.bin` kept in `app0`, 60 s runs. - PS5MC (PPSA99420): with this PR, #4374, #4383 and #5183 (`clock_settime`) it loads; `tools/import_audit.py` lists no absent import. It then needs #5184, #5185 and #5186 to get through Kodi's start-up, after which Kodi creates its GUI and runs 90 s. Build problem at this head (`71fbc3ce6`): `core/libs/prx/libkernel/File/src/Stdio.cpp` defines `static constexpr int GUEST_EOPNOTSUPP = 45;` twice (lines 302 and 308), so GCC 15 stops with `redefinition of 'constexpr const int GUEST_EOPNOTSUPP'`. One of the two lines needs to go; I dropped line 308 locally for the run above. AI-assisted (Claude Code).
github-actions[bot] commented 2026-10-13 19:05:45 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-13T19:05:45Z.


Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in Depends on.

Pull request Conflicting files (lines on main) Same exports Same new files
#4973 core/libs/prx/libkernel/File/src/Stdio.cpp L31
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6153056840 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/4379#issuecomment-6153056840). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-10-13T19:05:45Z. --- <!-- pr-overlap --> Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in **Depends on**. | Pull request | Conflicting files (lines on `main`) | Same exports | Same new files | |---|---|---|---| | #4973 | `core/libs/prx/libkernel/File/src/Stdio.cpp` [L31](https://github.com/boykopovar/AnyPS5/blob/ea2b2d364f070edafdac2cc9d58968ecb6485caa/core/libs/prx/libkernel/File/src/Stdio.cpp#L31) | | |
MarcZX10 commented 2026-10-13 20:28:32 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-13T20:28:32Z.


The title-run report identified a duplicate GUEST_EOPNOTSUPP definition in Stdio.cpp; I removed the redundant definition in commit b6a10e91a. tools/check_conventions.py --base upstream/main and git diff --check pass. I attempted a fresh Linux Release configure, but it stopped before compilation because this worktree's SDL2 submodule is uninitialized and the environment lacks XRandR development support. The hosted PR checks are running against this head.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6154559003 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/4379#issuecomment-6154559003). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-13T20:28:32Z. --- The title-run report identified a duplicate `GUEST_EOPNOTSUPP` definition in `Stdio.cpp`; I removed the redundant definition in commit `b6a10e91a`. `tools/check_conventions.py --base upstream/main` and `git diff --check` pass. I attempted a fresh Linux Release configure, but it stopped before compilation because this worktree's SDL2 submodule is uninitialized and the environment lacks XRandR development support. The hosted PR checks are running against this head.
MarcZX10 commented 2026-10-13 20:46:54 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-13T20:46:54Z.


Follow-up verification on the pushed head b6a10e91a: Linux x86-64, GCC 12.2, Ninja Release, fresh CMake configure with pinned submodules initialized. The guest_filesystem_tests target built successfully (including Stdio.cpp), and ctest -R '^guest_filesystem$' passed (1/1). This closes the local compile/test gap noted in my earlier update.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6154873020 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/4379#issuecomment-6154873020). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-13T20:46:54Z. --- Follow-up verification on the pushed head `b6a10e91a`: Linux x86-64, GCC 12.2, Ninja Release, fresh CMake configure with pinned submodules initialized. The `guest_filesystem_tests` target built successfully (including `Stdio.cpp`), and `ctest -R '^guest_filesystem$'` passed (1/1). This closes the local compile/test gap noted in my earlier update.
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
boykopovar/AnyPS5!4379
No description provided.