Repository navigation
fix: long data roots, coremod providers and failed-import cleanup (v0.29 regression findings) - #549
Merged
Merged
Conversation
…n escape Every inside/overlap check resolved both sides with dunce::canonicalize. dunce strips Windows' \?\ prefix only when it can (a path under MAX_PATH on a local drive, no reserved name), so a short .minecraft and a long child never shared a prefix: on a 161-character data root, importing RLCraft was refused with "overrides entry tried to escape the instance directory" (v0.29 regression pass, F1). Born v0.5.0. pathsafe::ResolvedPath resolves with std::fs::canonicalize and compares only with another ResolvedPath (is_within, join_unresolved), so mixing a resolved and a raw path no longer compiles. Moved onto it: overrides extraction, asset install and removal, hand-installed packs, the transfer overlap check, the Java exclusion of Lucerna's own runtimes. The asset removal check no longer uses exists(): NotFound skips it, any other error refuses. Detection keeps dunce only for the Java home it shows. tests/structural_no_dunce_compare.rs fails on any mention of dunce outside that one file (red on the old tree: 12 lines).
On Forge <= 1.12.2 a coremod (FMLCorePlugin in the manifest) registers a mod container: FML loads the class getModContainerClass() returns under the ModMetadata.modId it assigns. TNTUtils (RLCraft) requires tnt_utilities_core, which its own container provides; the pre-flight did not read containers, so every RLCraft profile read as unable to start and the Play gate listed it (v0.29 regression pass, F3). The legacy reader now follows FML: the plugin's getModContainerClass() code (an ldc of a class name or a class literal; more than one candidate names nothing), then the container's String stored straight into ModMetadata.modId / .version. A store on a jump target (a ternary) is skipped. A plugin or container that exists but cannot be read makes the jar "could not tell", never a cached "provides nothing". The provider is a new DescriptorSource::CoremodContainer, ranked like the annotation; same_mod::loader_ids leaves it out, so jar identity does not move. jar_scan_cache SCHEMA_VERSION 2 -> 3 rebuilds cached legacy scans. Fixtures: javac-compiled (JDK 17, --release 8) plugin/container classes of both eras, shaped like TntuPlugin / TntuCoremodContainer.
install_resolved_pack created the instance, then returned early with ? from four places (instance_dir, app_dir, the world snapshot, overrides extraction); nothing removed it, so a profile the toast said was never imported stayed in the list (v0.29 regression pass, F2). The work after create_instance runs in one async block. A returned error removes the instance (refused like any removal while a game runs or a maintenance holds it); a panic or a dropped future is covered by naming::DirCleanup. When the removal fails, the import returns the new ModpackImportLeftover naming the folder left on disk, with the import's own failure as the detail. A partial failure is unchanged: the instance stands.
…ctors Review follow-ups on the coremod container reader: - a Code attribute outside JVMS 4.7.3's 1..=65535 bytes is "could not tell": a crafted multi-megabyte method would cost one decoded instruction each; - jump targets are a HashSet, so a long method of branches and stores is not quadratic; - only <init> is searched for the ModMetadata stores: a store in another method may never run, or fill a second ModMetadata. Plus two comments: the leftover error's details are the cause's Display text, and the long-path extraction test is red only on Windows.
"Modpack overrides entry tried to escape the instance directory" named an internal folder and read like an attack report. The refusal now says what Lucerna did, why, and what to do: it did not touch the file because its path leads outside the profile's folder, which happens when a pack is damaged or built with a mistake; download it again or tell its author. The leftover error's English copy uses straight quotes like its neighbours, and the second changelog bullet's lead is reworded.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Three defects the v0.29 regression pass found (none introduced by v0.29), plus the refusal's wording:
sides with
dunce::canonicalize. dunce strips Windows'\\?\prefix only when it can (under MAX_PATH, a localdrive, no reserved name), so a short
.minecraftand a long child never shared a prefix: on a 161-character dataroot RLCraft was refused with "overrides entry tried to escape the instance directory". Born v0.5.0.
tnt_utilities_core, which its own jarprovides through a coremod's mod container; the ≤ 1.12.2 pre-flight did not read containers, so the Overview said
«Игра не запустится» and feat(modpacks): finish a pack whose files Lucerna can't download #548's Play gate added a false row.
words. It now says Lucerna did not touch the file because its path leads outside the profile's folder, that this
happens when a pack is damaged or built with a mistake, and what to do.
How
pathsafe::ResolvedPath(std canonicalize) compares only with anotherResolvedPath(is_within,join_unresolved), so mixing a resolved and a raw path no longer compiles. Moved onto it: overrides extraction,asset install/removal, hand-installed packs, the transfer overlap check, the Java exclusion of Lucerna's own
runtimes. The asset-removal check no longer uses
exists()(NotFound skips, any other error refuses).tests/structural_no_dunce_compare.rsfails on any mention of dunce outsidejava/detect.rs(display only).FMLCorePlugin→ what the plugin'sgetModContainerClass()code loads(one class; a string or a class literal) → the String the container's constructor stores straight into
ModMetadata.modId/.version. A store on a jump target (a ternary) is skipped; method code outside JVMS's1..=65535 bytes or a plugin/container that cannot be read is "could not tell" (never cached). New
DescriptorSource::CoremodContainer, ranked like the annotation, kept out ofsame_mod::loader_ids(jar identityunchanged).
jar_scan_cache::SCHEMA_VERSION2 → 3.install_resolved_pack: the work aftercreate_instanceruns in one async block; a returned error removes theinstance (refused like any removal while a game runs or a maintenance holds it),
naming::DirCleanupcovers a panicor a dropped future, and a removal that fails returns the new
ModpackImportLeftovernaming the folder. A partialfailure keeps the instance, as before.
Fallback discipline
resolve the parent refuses.
ModpackImportLeftover) andlogged with both errors.
Tests
expect), the dunce guard (12 lines on theold tree), the coremod tests and
dependency_preflight::legacy_requirement_met_by_its_own_jars_coremod_containeragainst a naive stub, the leftover decision against a stub; two mutations (ignore jump targets, read candidates from
every plugin method) caught exactly the four negative tests predicted.
--release 8) plugin/container classes of both eras, shaped like TNTUtils'TntuPlugin/TntuCoremodContainer; existing fixtures recompile byte-identical.dependency_preflight15, 24 structural guards (bare rustc; thetwo that need serde_json are CI's), Vitest 326 (format-error, changelog-parity, i18n parity + every-locale),
typecheck 0 errors, Biome/Prettier/no-network clean.
quadratic target lookup) and SHOULDs (constructor-only scan, comments, quote style, changelog lead) are in.
Live check (dev build, own identifier, 161-character Cyrillic data root — the maintainer's data untouched)
config/roguelike_dungeons/…file lands (395-character path).tnt_utilities_core..mrpackwhose override is../escape.txt: import fails with the new copy; no profile is left in the listor on disk.
ModpackImportLeftover(a removal that fails) — unit-tested only; could not be induced live.Changelog: two Fixed bullets, EN + RU at the same position.