Skip to content
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

Node cannot be installed to relative path #1124

Closed
mvilliger opened this issue Nov 23, 2023 · 3 comments · Fixed by #1125
Closed

Node cannot be installed to relative path #1124

mvilliger opened this issue Nov 23, 2023 · 3 comments · Fixed by #1125

Comments

@mvilliger
Copy link
Contributor

Do you want to request a feature or report a bug?
Report a Bug

What is the current behavior?
Using a relative path in installDirectory for goal install-node-and-npm always leads to "Bad zip entry" exception:

<plugin>
  <groupId>com.github.eirslett</groupId>
  <artifactId>frontend-maven-plugin</artifactId>
  <configuration>
    <installDirectory>${project.build.outputDirectory}/subfolder/../node</installDirectory>
    <nodeVersion>whatever</nodeVersion>
  </configuration>
</plugin>

The reason seems to be here where a normalized destPath is compared against a non-normalized destinationDirectory.
I assume the destinationDirectory should be normalized as well before comparing.

If the current behavior is a bug, please provide the steps to reproduce.
Execute the install-node-and-npm goal with a relative installDirectory for node as shown in the sample above.

What is the expected behavior?
Node is correctly extracted to the normalized path of the given relative installDirectory.

Please mention your frontend-maven-plugin and operating system version.
frontend-maven-plugin version: 1.14.2
operating system: any

@eirslett
Copy link
Owner

What is the use case for this? Is it not possible to achieve using ${maven.multiModuleProjectDirectory} or ${project.parent.basedir} or something like that? Why is node being installed inside outputDirectory (I assume it's one of the target folders)?

@mvilliger
Copy link
Contributor Author

We use a general parent pom which installs Node into the parent module's target dir as soon as the first sub-module is built which requires Node. For this the destination directory is configured using various properties which some might contain /../.

Anyway it should not have any downside to normalize both directories as comparing them only makes sense if both are compared normalized. Don't you think?

@mvilliger
Copy link
Contributor Author

mvilliger commented Nov 24, 2023

Another point: These kind of installDirectories used to work fine in version < 1.13. So it seems like a regression concerning this feature. Currently, this blocks us from updating the plugin.

eirslett pushed a commit that referenced this issue Nov 30, 2023
Otherwise, relative installDirectory paths cannot be used because the zip-slip
check fails with "Bad zip entry" exception even the zip is fine.

Closes #1124
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants