feat(libSceNKWebKit): implement JSC::ConfigFile construction, names and parse #25548
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/25548"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from boykopovar/AnyPS5. Originally posted by pinewhite on 2026-11-22T08:30:23Z.
What
Implements five
JSC::ConfigFileexports inlibSceNKWebKit, following the pinned ConfigFile.cpp and ConfigFile.h at80f77e94:_ZN3JSC10ConfigFileC1EPKc,_ZN3JSC10ConfigFileC2EPKc— the object is two 1025-byte name arrays (PATH_MAX1024); the file name is truncated to 1024 bytes and the config directory is cleared. A null name leaves both empty, as the source does._ZN3JSC10ConfigFile14setProcessNameEPKc,_ZN3JSC10ConfigFile20setParentProcessNameEPKc—strncpysemantics into the 128-byte static buffers, including zero padding a shorter name over a longer one._ZN3JSC10ConfigFile5parseEv— canonicalizes a relative name againstgetcwd, then reads the file with the source's line buffer,#comment stripping, blank-line skipping andisUnicodeCompatibleASCIIWhitespaceset, and parsesjscOptions { },logFile = "..."and theprocessName,parentProcessNameandbuildpredicates with their&&chains, nested-statement nesting and=~/pattern/iform. A skipped block still scans its body to the closing brace but contributes no options, as upstream.Two upstream seams are not implemented yet, so
parsethrowsstd::logic_errorinstead of applying them: a non-emptyjscOptionspayload (JSC::Options::setOptionsis a stub) and alogFilepath (WTF::setDataFile(const char*)is a stub).=~matches withstd::regex's POSIX extended grammar rather thanregexec, becauseHAVE(REGEX_H)on the console is unverified. Null objects, null names and name arrays without a terminating byte at index 1024 throwstd::invalid_argumentwhere the source faults._ZN3JSC17processConfigFileEPKcS1_S1_stays a stub.New files:
src/JscConfigFile.cpp,src/ConfigFileAbi.hpp(2050-byte layout withstatic_asserts),include/ConfigFileExports.hpp,tests/JscConfigFile.cpp. The five stubs and theirInventoryExports.hppdeclarations are removed. Debt entry added throughdocs/dev/debt/changes/feat-nkwebkit-jsc-config-file.md.python3 tools/progress.py --module libSceNKWebKit: 3915/11252 → 3920/11252 (the same five names move fromtodotodone, and no name moves intotodo;--rooton a pristine tree gives the same 3915 baseline).Tested
Not tested on a console; no title uses these exports yet.
Hand-built host proof on ARM64 (Linux, GCC 13,
g++ -std=c++20 -O1 -ffunction-sections -fdata-sections -Icore/libs -c, linked with-Wl,--gc-sections):Export.cppbodies of these five exports aborts on the first call —NotImplemented: _ZN3JSC10ConfigFileC1EPKc, exit 134../proof-postprintslibSceNKWebKit ConfigFile tests passed, exit 0.tests/JscConfigFile.cpp(registered asnkwebkit_jscconfigfile) calls the real exports and covers both constructors, 1200-byte name truncation, null and empty names, null objects, an object with unterminated name arrays, a missing file and an empty name (both logged throughWTF::dataLogFand returning),processName/parentProcessName/buildpredicates matching, skipped, chained and followed by a trailing comment, two sequential blocks,=~matching, case-insensitive and mismatched, an invalid regex (parse error, no throw),jscOptionsandlogFilethrowing when they apply, skipped when their block does not match, malformed statements (unknown statement, bare block, unterminated block, unknown predicate,logFilewithout quotes, option without=or value), reuse of both name buffers, and relative-name canonicalization against a temporarygetcwd.Shims used only for the hand build, none of them the code under test:
fopen/fgets/fclose/getcwd/chdir_nid_postfixover host stdio,CopyGuestString/GuestCopyIn/GuestCopyOutover host memory, the path-alias table,WTF::dataLogFovervfprintf, andApplicationHeapRegister. A full CMake/CTest run was not made on this host (no Ninja, two cores, submodules not initialised);python3 tools/check_conventions.py --base origin/mainpasses on the commit.Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file.mdfiles or images added to the repository (attach them to this PR)tools/pr_overlap.py --branch feat/nkwebkit-jsc-config-filelists three refactors that split libraries (#24322, #24910, #24917) and #23860 (trap bodies), which delete neighbouring lines ofExport.cppandInventoryExports.hpparound these stubs; none of them implements or removes these five exports.Imported from boykopovar/AnyPS5. Originally posted by PrivacyOnion on 2026-11-22T08:33:27Z.
Review: CHANGES_REQUESTED
Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against
d878bfe5e8:tools/check_conventions.pypassed.nkwebkit_jscconfigfile_testsbuilt cleanly.nkwebkit_jscconfigfile):Requesting changes for the points above.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-22T08:34:03Z.
Review: COMMENTED
Reviewed — comments
The parser skips validation of later conditions when an earlier predicate in an
&&chain fails, so malformed config input can be accepted as a skipped block.What I ran
Reviewed head
d878bfe5e8a1da7e9d7b2bc9d95641a8961e0c6b. Read the prepared diff and repository sources throughrepo_read.py; no tests or other commands were run.Results
Findings
Blocking
None.
Non-blocking
core/libs/prx/libSceNKWebKit/src/JscConfigFile.cpp:325: IfParsePredicatereturns false, the loop neither errors nor checks for&&; it proceeds to expect{. After an earlier chain member fails, a later malformed condition such asnonsenseis therefore not validated and can be skipped if followed by a block. Validate every predicate and returnResult::Errorwhen parsing fails; add a regression test with a failed first condition and malformed trailing condition.Not verified
Export.cppandInventoryExports.hppwere excluded from the prepared full-file bundle; their relevant hunks were read from the prepared diff. Other excluded paths listed infiles.jsonwere not reviewed.To get this to a good state
Nothing is required. Optional: validate every predicate in an
&&chain and add coverage for a malformed condition after a failing predicate.Imported from boykopovar/AnyPS5. Originally posted by PrivacyOnion on 2026-11-22T14:12:37Z.
Review: APPROVED
Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against
a2e45c2255:tools/check_conventions.pypassed.nkwebkit_jscconfigfile_testsbuilt cleanly.nkwebkit_jscconfigfile):core/libs/prx/libSceNKWebKit/Export.cpp,core/libs/prx/libSceNKWebKit/include/InventoryExports.hpp,core/libs/prx/libSceNKWebKit/libSceNKWebKit.hpp,core/libs/prx/libSceNKWebKit/src/JscConfigFile.cppreverted tomain, the new tests do not build/link without the change; restoring it makes them build and pass.Looks Good To Me
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-22T14:30:04Z.
Review: COMMENTED
Reviewed — comments
The parser and ABI implementation have concrete edge cases that need clarification before I can recommend a formal merge decision.
What I ran
Reviewed head
a2e45c2255082ce9ffd5a024bfaf6407348f267f. I read the prepared description, commit list, diff, manifest and review-folder README; targeted source at the pinned head was read withrepo_read.py. No build or test command was run. The author reports a hand-built host proof and a passing conventions check; these were not run during this review.Results
Findings
Blocking
None verified.
Non-blocking
JscConfigFile.cpp:325— If parsing a predicate fails (for example,processName = "x"),ParseConditionalBlockdoes not return an error. It falls through to consume{, so malformed predicates can be accepted as a block with a false match. Return an error whenParsePredicatefails, and add a malformed-operator case to the tests.JscConfigFile.cpp:143— Regex parsing treats the first slash as the delimiter and does not account for escaped slashes. Patterns such as/foo\\/bar/therefore do not follow normal regex-delimiter semantics. Consider parsing escaped delimiters and test one such pattern.JscConfigFile.cpp:351— The relative-path length check accounts for the working directory and optional separator, but not the filename length.strncatthen silently truncates the path to the fixed buffer while the code reports success. Check the total required length before appending and add a near-limit path test.Not verified
The changed lines in
Export.cppandInventoryExports.hpponly remove the five old declarations/stubs in the prepared diff; their full files were not read. No upstream source checkout, CMake build, CTest run, or console behavior was independently verified. The host proof and conventions result in the description are author-reported.Files read:
ConfigFileExports.hpp,libSceNKWebKit.hpp,ConfigFileAbi.hpp,JscConfigFile.cpp,tests/JscConfigFile.cpp, and the debt note, along with the prepared review documents. The full text ofExport.cppandInventoryExports.hppwas excluded from the review bundle; their changed hunks were inspected indiff.patch.To get this to a good state
Nothing is required. Optional points: reject malformed predicates, define escaped slash handling in regex literals, and reject overlong canonical paths rather than silently truncating them.
Imported from boykopovar/AnyPS5. Originally posted by throny on 2026-11-22T16:23:42Z.
Review: COMMENTED
Review: ⚠️ faithful port of
JSC::ConfigFile, but an invalid=~pattern aborts the process on WindowsBasis: code read against
neonmodder123/PS5-WebKit-11.x@80f77e94c6ConfigFile.cpp/.h· heada2e45c2255Checked
static_asserted), constructor truncation, and the 128-byte name setters all match upstream. Paths go throughgetcwd_nid_postfix/fopen_nid_postfix, never raw host paths.jscOptions/logFile, theprocessName/parentProcessName/buildpredicates,&&chains and nesting. A malformed operator is a parse error in both, so I don't think the "skipped block" divergence raised earlier is real.Findings
JscConfigFile.cpp:324-332:std::regexthrowsregex_errorfromlibstdc++-6.dllon Windows, and the prx has no unwind data for that frame, so thecatchis never reached. A config with a bad=~pattern (the test'sprocessName =~ /(/) aborts instead of returning a parse error the way upstream'sregcompfailure does. JJenkx reproduced this 3/3 on Windows. A non-throwing matcher is needed: either validate the pattern up front or use an error-code API.JscConfigFile.cpp:413-416:parsethrows for anylogFileor non-emptyjscOptions, so only empty or fully skipped configs succeed. That is honest, and the debt fragment records it, as it does the unverifiedHAVE(REGEX_H)on the console. I'm noting it only so a maintainer is aware that the export is counted as implemented.Suggested action: fix 1, then merge
AI-assisted review (Claude Code) · head
a2e45c2255· basemain23b8772462Imported from boykopovar/AnyPS5. Originally posted by throny on 2026-11-23T07:00:42Z.
Review: APPROVED
Review: ✅ re-review: the Windows abort is the libc exception-delivery bug fixed by #25935, not this PR
Basis: commit read, plus JJenkx's Windows run with #25935 (3/3) · head
6cc898863bChecked
=~invalid-pattern path aborted on Windows because theregex_errorthrown insidelibstdc++-6.dllnever reached thecatchinJscConfigFile.cpp:300. JJenkx traced that to libc's exception delivery, which #25935 fixes, and with itnkwebkit_jscconfigfilepasses 3/3 on Windows. Thecatchhere is therefore correct code, and the remedy belongs in libc, not in a different matcher.6cc898863bonly switches the test fixture to the guest working directory. TheConfigFilesource is unchanged, and so is my reading of its layout and grammar against80f77e94c6.Findings
none (the earlier note that
parsethrows forlogFile/jscOptionsstands, and is recorded in the debt fragment)Suggested action: merge after #25935 (the Windows test needs it)
AI-assisted review (Claude Code) · head
6cc898863b· basemain23b8772462Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-23T07:28:15Z.
Review: CHANGES_REQUESTED
Reviewed — changes requested
Changes are required before merge: fix the conditional parser so each predicate in an
&&chain is parsed and evaluated, including when an earlier predicate does not match.What I ran
description.md,commits.md,manifest.json, anddiff.patch; inspected the changed parser, tests, CMake registration, and nearby export context through the pinned reader.6cc898863bca5a7fc6cf5f9ca55a89deef9318a0.Results
Findings
Blocking
core/libs/prx/libSceNKWebKit/src/JscConfigFile.cpp:430: A predicate whose syntax parses but whose value does not match setssubNestingtoNestedFailedCriteria, then breaks out of the&&loop becauseTryConsume("&&")fails when the scanner is still positioned at the comparison value. For example,processName == "delta" && build == "Release" { ... }leaves the scanner at"delta"and reports a parse error instead of skipping the block. Consume the full predicate value and continue evaluating the chain even after a mismatch; mark the whole block skipped if any predicate fails.Non-blocking
Not verified
core/libs/prx/libSceNKWebKit/Export.cppandcore/libs/prx/libSceNKWebKit/include/InventoryExports.hppwere excluded from the prepared review folder as too large. The available reader returned the export context around the removed stubs, but the complete files were not reviewed.To get this to a good state
&&and a valid block body, then rerun the targeted test.Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-23T09:34:08Z.
Review: APPROVED
Reviewed — looks good
Nothing blocks this change; the points below are optional.
What I ran
Reviewed head
62af34c7a1de24fc365eb8390cd3f7bd2f634498against the prepared diff and inspected targeted source context withrepo_read.py. No build or test command was run. The PR description reports a hand-built ARM64 Linux host proof and a passing conventions check; those runs were not independently verified.Results
Findings
Blocking
None.
Non-blocking
TryConsumeStringandTryConsumeRegExPatternsearch only the current 1024-byte scanner buffer for a closing delimiter, so a quoted value or regex spanning afgetsboundary is treated as malformed. Consider preserving scanner state across buffers or explicitly rejecting overlong tokens. (core/libs/prx/libSceNKWebKit/src/JscConfigFile.cpp:234,core/libs/prx/libSceNKWebKit/src/JscConfigFile.cpp:245)Not verified
core/libs/prx/libSceNKWebKit/include/ConfigFileExports.hpp,core/libs/prx/libSceNKWebKit/libSceNKWebKit.hpp,core/libs/prx/libSceNKWebKit/src/ConfigFileAbi.hpp,core/libs/prx/libSceNKWebKit/src/JscConfigFile.cpp,core/libs/prx/libSceNKWebKit/tests/JscConfigFile.cpp, anddocs/dev/debt/changes/feat-nkwebkit-jsc-config-file.md; relevant changed hunks inExport.cppandInventoryExports.hpp; targeted context inCMakeLists.txtandcore/libs/prx/libc/src/General.cpp.core/libs/prx/libSceNKWebKit/Export.cppandcore/libs/prx/libSceNKWebKit/include/InventoryExports.hpp(both too large). The diff hunks for their removed stubs and declarations were inspected.files.jsonwas not available in the prepared review folder; the manifest identifies these exclusions.To get this to a good state
Nothing is required. Optional: handle quoted strings and regex patterns that cross scanner-buffer boundaries.
Imported from boykopovar/AnyPS5. Originally posted by ligmaSec on 2026-12-03T12:42:52Z.
Review: COMMENTED
Compiled and ran the exact
JscConfigFilefixture on Linux with the branch’s changed sources and existing WebKit libraries. The configuration-file parsing and directory-restoration checks passed.AI-assisted: yes.
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.