jlink.online icon indicating copy to clipboard operation
jlink.online copied to clipboard

Cross targeting fails on Windows if target runtime contains symlinks

Open aahlenst opened this issue 5 years ago • 1 comments

https://github.com/AdoptOpenJDK/jlink.online/blob/e0b932e90aef03350e1a757b62d5b6c6c64fe530/jlink_test.go#L106 fails on Windows. The reason is that the tar.gz for Linux contains symlinks. Those cause archiver.Unarchive() to fail (as well as 7zip, so not archiver's fault) with the following error:

reading file in tar archive: C:\Users\andreas\AppData\Local\Temp\runtime_cache\OpenJDK11U-jdk_x64_linux_hotspot_11.0.8_10\jdk-11.0.8+10\legal\jdk.localedata\ASSEMBLY_EXCEPTION: making symbolic link for: symlink ..\java.base\ASSEMBLY_EXCEPTION C:\Users\andreas\AppData\Local\Temp\runtime_cache\OpenJDK11U-jdk_x64_linux_hotspot_11.0.8_10\jdk-11.0.8+10\legal\jdk.localedata\ASSEMBLY_EXCEPTION: A required privilege is not held by the client.

I'm not sure how to proceed here. https://pkg.go.dev/github.com/mholt/archiver/v3#TarGz has no option to ignore symlinks or continue on error. We could ignore the return code and continue no matter what, but I don't think this is desirable.

aahlenst avatar Nov 07 '20 12:11 aahlenst

I had the same problem when creating an archive containing symlinks and added this line as a temporary solution: https://github.com/AdoptOpenJDK/jlink.online/blob/31321e3d1eb1c418f5ae0468fe8538e18a917c60/jlink.go#L390

But I didn't have any problems extracting an archive with symlinks on Windows. I'll have to spin up a Windows VM and see what I can find.

cilki avatar Nov 07 '20 14:11 cilki