Skip to content

Layer written outside the output location of '//' exception is thrown when using extract layers in root directory#50501

Merged
mhalbritter merged 2 commits into
spring-projects:3.5.xfrom
DragonFSKY:gh-50495-root-output-directory
May 27, 2026
Merged

Layer written outside the output location of '//' exception is thrown when using extract layers in root directory#50501
mhalbritter merged 2 commits into
spring-projects:3.5.xfrom
DragonFSKY:gh-50495-root-output-directory

Conversation

@DragonFSKY

@DragonFSKY DragonFSKY commented May 25, 2026

Copy link
Copy Markdown
Contributor

Running the extract --layers --launcher tools command with the filesystem root as the output directory can fail after layer directory normalization. The containment check appends File.separator to the canonical output path before testing a layer location, which turns / into // and causes valid layer directories such as /dependencies to be rejected as outside the output location.

This update uses canonical Path containment checks for both entries and layer directories. It keeps the existing behavior of rejecting paths that are equal to, or outside of, the output directory, and adds command-level coverage for extraction with the filesystem root as the destination while keeping the test output under the test temporary directory.

Closes #50495

Tests:

  • ./gradlew :loader:spring-boot-jarmode-tools:check --rerun-tasks

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label May 25, 2026
@DragonFSKY DragonFSKY force-pushed the gh-50495-root-output-directory branch from 3e834a2 to 2da6326 Compare May 26, 2026 01:44
@philwebb philwebb added type: regression A regression from a previous release and removed status: waiting-for-triage An issue we've not yet triaged labels May 26, 2026
@philwebb philwebb added this to the 3.5.x milestone May 26, 2026
@philwebb philwebb changed the title Handle root output directory when extracting layers Layer written outside the output location of '//' exception can be thrown when building in root directory May 26, 2026
@philwebb philwebb changed the title Layer written outside the output location of '//' exception can be thrown when building in root directory Layer written outside the output location of '//' exception is thrown when using extract layers in root directory May 26, 2026
@mhalbritter mhalbritter self-assigned this May 27, 2026
DragonFSKY and others added 2 commits May 27, 2026 10:31
Use canonical Path containment checks so layer directories under the
filesystem root are accepted while entries and layer names that escape
the output directory remain rejected.

See spring-projectsgh-50501

Signed-off-by: Dongliang Xie <dragonfsky@gmail.com>
@mhalbritter mhalbritter changed the base branch from main to 3.5.x May 27, 2026 08:37
@mhalbritter mhalbritter force-pushed the gh-50495-root-output-directory branch from 2da6326 to db1ebf5 Compare May 27, 2026 08:38
@mhalbritter mhalbritter merged commit 29e2456 into spring-projects:3.5.x May 27, 2026
3 of 4 checks passed
@mhalbritter mhalbritter modified the milestones: 3.5.x, 3.5.15 May 27, 2026
@mhalbritter

Copy link
Copy Markdown
Contributor

Thanks @DragonFSKY !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type: regression A regression from a previous release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Layer tools lost support for buildng in root ('/')

4 participants