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

[BUG] SymbolicLinkPreservingUntarTransform fails on Windows #1430

Closed
reta opened this issue Oct 22, 2021 · 5 comments · Fixed by #1433
Closed

[BUG] SymbolicLinkPreservingUntarTransform fails on Windows #1430

reta opened this issue Oct 22, 2021 · 5 comments · Fixed by #1433
Labels
bug Something isn't working

Comments

@reta
Copy link
Collaborator

reta commented Oct 22, 2021

Describe the bug
When building distribution on Windows, the ./gradle assemble task fails with

> Task :distribution:archives:buildLinuxArm64Tar FAILED
> Task :distribution:archives:buildLinuxTar FAILED

It turned out that this task fail while unpacking JDK distribution(s) which may contain the symbolic link.

Execution failed for task ':distribution:archives:buildLinuxArm64Tar'.
> Could not resolve all files for configuration ':distribution:archives:jdk_bundled_linux_aarch64'.
   > Failed to transform linux-17-aarch64.tar.gz (adoptium_17:linux:17) to match attributes {artifactType=directory, jdk=true, org.gradle.status=integration}.
      > Execution failed for SymbolicLinkPreservingUntarTransform: C:\Users\user\.gradle\caches\modules-2\files-2.1\adoptium_17\linux\17\6b66e4a3462105ee5b330567a81e4c80541f9d64\linux-17-aarch64.tar.gz.
         > java.nio.file.FileSystemException: C:\Users\user\.gradle\caches\transforms-2\files-2.1\affc3b5d8522bb66d49b017b6ee297fc\linux-17-aarch64.tar.gz\legal\jdk.hotspot.agent\LICENSE: A required privilege is not held by the client.

On Windows, it requires special permission which may not be granted to the user. The related JDK issue is https://bugs.openjdk.java.net/browse/JDK-8218418 but sadly it works JDK13+ and Windows 10 with developer mode enabled.

To Reproduce
Steps to reproduce the behavior:

$ ./gradlew assemble


> Task :distribution:archives:buildLinuxArm64Tar FAILED
> Task :distribution:archives:buildLinuxTar FAILED

FAILURE: Build completed with 2 failures.

1: Task failed with an exception.
-----------
* What went wrong:
Execution failed for task ':distribution:archives:buildLinuxTar'.
> Could not resolve all files for configuration ':distribution:archives:jdk_bundled_linux_x64'.
   > Failed to transform linux-17-x64.tar.gz (adoptium_17:linux:17) to match attributes {artifactType=directory, jdk=true, org.gradle.status=integration}.
      > Execution failed for SymbolicLinkPreservingUntarTransform: C:\Users\user\.gradle\caches\modules-2\files-2.1\adoptium_17\linux\17\5251cd426380ef47bb794263f9a7d772140e054f\linux-17-x64.tar.gz.
         > java.nio.file.FileSystemException: C:\Users\user\.gradle\caches\transforms-2\files-2.1\e3fb1478f71525cbedd6983f1bf95bd1\linux-17-x64.tar.gz\legal\jdk.naming.rmi\LICENSE: A required privilege is not held by the client.

Expected behavior
The build should not fail.

Plugins
N/A

Screenshots
If applicable, add screenshots to help explain your problem.

Host/Environment (please complete the following information):

  • OS: Windows 10

Additional context
Related issue #1412

@reta reta added bug Something isn't working untriaged labels Oct 22, 2021
@reta reta mentioned this issue Oct 22, 2021
1 task
@dblock
Copy link
Member

dblock commented Oct 22, 2021

Is there a command-line workaround to grant this special permission?

@dblock
Copy link
Member

dblock commented Oct 22, 2021

It seems like we shouldn't need to build all distributions by default all the time, but it's NBD: for the bundle, we only build the target distribution that we're trying to produce here, so while this is a cross-platform bug of building a Linux distribution on Windows, this can be left as an exercise.

@reta
Copy link
Collaborator Author

reta commented Oct 22, 2021

Is there a command-line workaround to grant this special permission?

The user has to be an administrator.

It seems like we shouldn't need to build all distributions by default all the time,

This is good point. I think right now we use Linux based CI to build Linux / MacOS / Windows distributions and releases. It works well, so we probably should keep it. Otherwise, we would need to have Linux / MacOS / Windows agents to build the OS-specific distributions (I saw you already brought it up).

I see basically two options:

  1. Do not build Linux + MacOs distros on Windows
  2. Skip over symbolic links on Windows (easy to do). Is it better than having no distributions at all? Not 100% sure.

What do you think?

@dblock
Copy link
Member

dblock commented Oct 22, 2021

I think it would be nice if ./gradlew build just passed on Windows, even if nobody is going to really care. I think (1) is better because (2) seems to produce something incorrect?

@reta
Copy link
Collaborator Author

reta commented Oct 22, 2021

Agree, I would make a PR on Monday, I believe I figured out where distribution tasks are created.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants