Skip to content

Commit 3823fe5

Browse files
committed
harden(manifest): the xpkg path fills sources and now says so
`sourcesDeclared` distinguishes "no `sources` key" from `sources = []`, and the xpkg descriptor parser filled the list without setting it. Harmless today — that synthesiser refuses a descriptor with no sources and never calls apply_defaults_and_infer — but a false flag beside a non-empty list is a trap: the day that function runs on an xpkg manifest, its explicit list is replaced by the default glob and every descriptor-described package quietly compiles the wrong file set.
1 parent b5be639 commit 3823fe5

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

src/manifest/xpkg.cppm

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1227,6 +1227,13 @@ synthesize_from_xpkg_lua(std::string_view luaContent,
12271227
if (!s.empty()) {
12281228
m.modules.sources.push_back(s);
12291229
m.buildConfig.sources.push_back(std::move(s)); // M5.0 mirror
1230+
// The descriptor said `sources`, so record that it did.
1231+
// Harmless today — this synthesiser never runs
1232+
// apply_defaults_and_infer, and it REFUSES a descriptor with
1233+
// no sources at all — but leaving the flag false here means
1234+
// an xpkg manifest that ever reached that function would
1235+
// have its explicit list replaced by the default glob.
1236+
m.buildConfig.sourcesDeclared = true;
12301237
}
12311238
cur.skip_ws_and_comments();
12321239
}

0 commit comments

Comments
 (0)