Repository navigation
feat(artifacts): add dry-run plan for artifact extraction #7177
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from 1 commit
777b04a
47f478c
93c3ab3
74029e0
77f9884
545c4e3
20ae0c4
a0bf542
8f417b4
041f0ef
f2305a1
4c411c0
38a8e9d
e37d5ef
2f987e4
e29807d
8facdbb
0ffad06
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
… case folds in dry-run plan - Return canonicalOutput from SafeOutputTree.checkDestination and measure destination path length against the resolved parent path and portable 1024-byte/260-char whole-path thresholds. - Fold multi-code-point Unicode case expansions (such as ß/ss) in destinationCaseCollisions so case-table-dependent entries remain unresolved in dry-run plans. Refs #5489
- Loading branch information
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -349,12 +349,14 @@ const materializeSelection = async ({ | |
| const platform = input.platform ?? process.platform; | ||
| let destinationCaseSensitivity: DestinationCaseSensitivity = | ||
| "case-sensitive"; | ||
| let resolvedOutputRoot = absoluteCallerPath(input.outputRoot); | ||
| if (dryRun) { | ||
| const destination = await SafeOutputTree.checkDestination( | ||
| input.outputRoot, | ||
| { resourceScope: input.resourceScope }, | ||
| ); | ||
| destinationCaseSensitivity = destination.caseSensitivity; | ||
| resolvedOutputRoot = destination.canonicalOutput ?? resolvedOutputRoot; | ||
| } else { | ||
| try { | ||
| output = await SafeOutputTree.create(input.outputRoot, platform); | ||
|
|
@@ -377,7 +379,7 @@ const materializeSelection = async ({ | |
| zipSource !== undefined || reader.prepareContainer !== undefined; | ||
| unresolvedPlan = await planSelectedEntries({ | ||
| reader, | ||
| outputRoot: input.outputRoot, | ||
| outputRoot: resolvedOutputRoot, | ||
| platform, | ||
| caseSensitivity: destinationCaseSensitivity, | ||
| verifyContent: !containerVerified, | ||
|
|
@@ -459,22 +461,34 @@ interface UnresolvedDryRunPlan { | |
| } | ||
|
|
||
| const MAX_PORTABLE_NAME_BYTES = 255; | ||
| const MAX_PORTABLE_PATH_BYTES = 4095; | ||
| const MAX_PORTABLE_POSIX_PATH_BYTES = 1023; | ||
| const MAX_PORTABLE_WIN32_PATH_LENGTH = 259; | ||
|
|
||
| const overLimitDestinationReason = ( | ||
| outputRoot: string, | ||
| resolvedOutputRoot: string, | ||
| destinationPath: string, | ||
| platform: NodeJS.Platform, | ||
| ): string | undefined => { | ||
| const segments = destinationPath.split("/"); | ||
| for (const segment of segments) { | ||
| const byteLength = Buffer.byteLength(segment, "utf8"); | ||
| if (byteLength > MAX_PORTABLE_NAME_BYTES) | ||
| if ( | ||
| byteLength > MAX_PORTABLE_NAME_BYTES || | ||
| segment.length > MAX_PORTABLE_NAME_BYTES | ||
|
Comment on lines
+851
to
+852
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
When the selected destination has a component limit below 255 bytes, such as an eCryptfs mount with encrypted filenames and a roughly 143-byte usable plaintext limit, an ASCII segment between that limit and 255 bytes bypasses this branch and is reported AGENTS.md reference: AGENTS.md:L81-L81 Useful? React with 👍 / 👎. |
||
| ) | ||
| return `Destination filesystem component length limit (such as 255-byte NAME_MAX) is not observed without creating files; segment of ${String(byteLength)} UTF-8 bytes in ${destinationPath} remains unresolved during dry-run.`; | ||
| } | ||
| const fullDestination = join(absoluteCallerPath(outputRoot), ...segments); | ||
| const fullDestination = join(resolvedOutputRoot, ...segments); | ||
| if ( | ||
| platform === "win32" && | ||
| (fullDestination.length > MAX_PORTABLE_WIN32_PATH_LENGTH || | ||
| Buffer.byteLength(fullDestination, "utf8") > | ||
| MAX_PORTABLE_WIN32_PATH_LENGTH) | ||
| ) | ||
| return `Destination filesystem path length limit (such as 260-character Windows MAX_PATH) is not observed without creating files; destination path of ${String(fullDestination.length)} UTF-16 code units for ${destinationPath} remains unresolved during dry-run.`; | ||
| const fullBytes = Buffer.byteLength(fullDestination, "utf8"); | ||
| if (fullBytes > MAX_PORTABLE_PATH_BYTES) | ||
| return `Destination filesystem path length limit (such as 4095-byte PATH_MAX) is not observed without creating files; destination path of ${String(fullBytes)} UTF-8 bytes for ${destinationPath} remains unresolved during dry-run.`; | ||
| if (fullBytes > MAX_PORTABLE_POSIX_PATH_BYTES) | ||
| return `Destination filesystem path length limit (such as 1024-byte Darwin/portable PATH_MAX) is not observed without creating files; destination path of ${String(fullBytes)} UTF-8 bytes for ${destinationPath} remains unresolved during dry-run.`; | ||
| return undefined; | ||
| }; | ||
|
|
||
|
|
@@ -604,6 +618,7 @@ const planSelectedEntries = async ({ | |
| const overLimitReason = overLimitDestinationReason( | ||
| outputRoot, | ||
| destinationPath, | ||
| platform, | ||
| ); | ||
| if (overLimitReason !== undefined) { | ||
| unresolvedByOccurrenceId.set( | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When an ASAR has an
unpackedmember and its.asar.unpackedcompanion is replaced or removed after inventory,reader.prepareContainermakescontainerVerifiedtrue even though it snapshots only the ASAR container; this setsverifyContentfalse, soplanSelectedEntriesnever opens the external companion and returns the stale size/SHA asplanned, while real extraction opens it and rejects the mismatch or missing file. Fresh evidence beyond the earlier directory-source report is that these member bytes live outside the prepared container; revalidate unpacked entries or keep their freshness unresolved.AGENTS.md reference: AGENTS.md:L50-L52
Useful? React with 👍 / 👎.