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

Wrong encoding for decoding dlerror's output #738

Closed
kb-1000 opened this issue Feb 23, 2022 · 1 comment · Fixed by #739
Closed

Wrong encoding for decoding dlerror's output #738

kb-1000 opened this issue Feb 23, 2022 · 1 comment · Fixed by #739

Comments

@kb-1000
Copy link
Contributor

kb-1000 commented Feb 23, 2022

Version

3.3.0 (nightly), 3.2.3, 3.2.2, 3.2.1

Platform

Linux x64, Linux arm64, Linux arm32

JDK

any

Module

LWJGL core

Bug description

Try loading a native library that does not exist from a location that contains a non-ASCII character, or using a system locale that involves non-ASCII characters in the respective error message.

Now, look at the error message: you'll see it using characters that hint UTF-8 text being decoded using latin-1.

note: the characters of the path here appear correct because the exception here is from 3.2.2, before a10f862. This issue, however, still exists (on master):

/**
* Returns a human readable string describing the most recent error that occurred from {@link #dlopen}, {@link #dlsym} or {@link #dlclose} since
* the last call to {@code dlerror()}. It returns {@code NULL} if no errors have occurred since initialization or since it was last called.
*/
@Nullable
@NativeType("char *")
public static String dlerror() {
long __result = ndlerror();
return memASCIISafe(__result);
}

It's possible this happens on macOS too, but I haven't checked for that.

Stacktrace or crash log output

[22:55:10] [Render thread/INFO]: [STDERR]: java.lang.ExceptionInInitializerError
[22:55:10] [Render thread/INFO]: [STDERR]: 	at dvt.<init>(SourceFile:157)
[22:55:10] [Render thread/INFO]: [STDERR]: 	at dvp.<init>(SourceFile:459)
[22:55:10] [Render thread/INFO]: [STDERR]: 	at net.minecraft.client.main.Main.main(SourceFile:179)
[22:55:10] [Render thread/INFO]: [STDERR]: 	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[22:55:10] [Render thread/INFO]: [STDERR]: 	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:78)
[22:55:10] [Render thread/INFO]: [STDERR]: 	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[22:55:10] [Render thread/INFO]: [STDERR]: 	at java.base/java.lang.reflect.Method.invoke(Method.java:567)
[22:55:10] [Render thread/INFO]: [STDERR]: 	at org.multimc.onesix.OneSixLauncher.launchWithMainClass(OneSixLauncher.java:210)
[22:55:10] [Render thread/INFO]: [STDERR]: 	at org.multimc.onesix.OneSixLauncher.launch(OneSixLauncher.java:245)
[22:55:10] [Render thread/INFO]: [STDERR]: 	at org.multimc.EntryPoint.listen(EntryPoint.java:143)
[22:55:10] [Render thread/INFO]: [STDERR]: 	at org.multimc.EntryPoint.main(EntryPoint.java:34)
[22:55:10] [Render thread/INFO]: [STDERR]: Caused by: java.lang.RuntimeException: java.lang.UnsatisfiedLinkError: Failed to dynamically load library: /home/kb1000/MultiMC5-Install/instances/pré1.18/natives/libglfw.so(error = /home/kb1000/MultiMC5-Install/instances/pré1.18/natives/libglfw.so: Kann die Shared-Object-Datei nicht öffnen: Datei oder Verzeichnis nicht gefunden)
[22:55:10] [Render thread/INFO]: [STDERR]: 	at dpg.<clinit>(SourceFile:46)
[22:55:10] [Render thread/INFO]: [STDERR]: 	... 11 more
[22:55:10] [Render thread/INFO]: [STDERR]: Caused by: java.lang.UnsatisfiedLinkError: Failed to dynamically load library: /home/kb1000/MultiMC5-Install/instances/pré1.18/natives/libglfw.so(error = /home/kb1000/MultiMC5-Install/instances/pré1.18/natives/libglfw.so: Kann die Shared-Object-Datei nicht öffnen: Datei oder Verzeichnis nicht gefunden)
[22:55:10] [Render thread/INFO]: [STDERR]: 	at org.lwjgl.system.linux.LinuxLibrary.loadLibrary(LinuxLibrary.java:32)
[22:55:10] [Render thread/INFO]: [STDERR]: 	at org.lwjgl.system.linux.LinuxLibrary.<init>(LinuxLibrary.java:19)
[22:55:10] [Render thread/INFO]: [STDERR]: 	at org.lwjgl.system.APIUtil.apiCreateLibrary(APIUtil.java:123)
[22:55:10] [Render thread/INFO]: [STDERR]: 	at org.lwjgl.system.Library.loadNative(Library.java:335)
[22:55:10] [Render thread/INFO]: [STDERR]: 	at org.lwjgl.system.Library.loadNative(Library.java:281)
[22:55:10] [Render thread/INFO]: [STDERR]: 	at org.lwjgl.system.Library.loadNative(Library.java:205)
[22:55:10] [Render thread/INFO]: [STDERR]: 	at org.lwjgl.glfw.GLFW.<clinit>(GLFW.java:674)
[22:55:10] [Render thread/INFO]: [STDERR]: 	at java.base/jdk.internal.misc.Unsafe.ensureClassInitialized0(Native Method)
[22:55:10] [Render thread/INFO]: [STDERR]: 	at java.base/jdk.internal.misc.Unsafe.ensureClassInitialized(Unsafe.java:1155)
[22:55:10] [Render thread/INFO]: [STDERR]: 	at java.base/java.lang.invoke.DirectMethodHandle$EnsureInitialized.computeValue(DirectMethodHandle.java:378)
[22:55:10] [Render thread/INFO]: [STDERR]: 	at java.base/java.lang.invoke.DirectMethodHandle$EnsureInitialized.computeValue(DirectMethodHandle.java:375)
[22:55:10] [Render thread/INFO]: [STDERR]: 	at java.base/java.lang.ClassValue.getFromHashMap(ClassValue.java:228)
[22:55:10] [Render thread/INFO]: [STDERR]: 	at java.base/java.lang.ClassValue.getFromBackup(ClassValue.java:210)
[22:55:10] [Render thread/INFO]: [STDERR]: 	at java.base/java.lang.ClassValue.get(ClassValue.java:116)
[22:55:10] [Render thread/INFO]: [STDERR]: 	at java.base/java.lang.invoke.DirectMethodHandle.checkInitialized(DirectMethodHandle.java:401)
[22:55:10] [Render thread/INFO]: [STDERR]: 	at java.base/java.lang.invoke.DirectMethodHandle.ensureInitialized(DirectMethodHandle.java:389)
[22:55:10] [Render thread/INFO]: [STDERR]: 	at java.base/java.lang.invoke.DirectMethodHandle.ensureInitialized(DirectMethodHandle.java:423)
[22:55:10] [Render thread/INFO]: [STDERR]: 	at dpg.<clinit>(SourceFile:43)
@Spasi
Copy link
Member

Spasi commented Feb 24, 2022

@kb-1000 Thanks!

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

Successfully merging a pull request may close this issue.

2 participants