Error message not properly printed when a unsafe symlink found
jackalcooper opened this issue · comments
Shenghang Tsai commented
when downloading and loading the tar contains a symlink:
== Compilation error in file lib/beaver/mlir/capi.ex ==
** (Protocol.UndefinedError) protocol String.Chars not implemented for {'[a path to an unsafe symlink]', :unsafe_symlink} of type Tuple
(elixir 1.14.0) lib/string/chars.ex:3: String.Chars.impl_for!/1
(elixir 1.14.0) lib/string/chars.ex:22: String.Chars.to_string/1
(rustler_precompiled 0.5.2) lib/rustler_precompiled.ex:126: RustlerPrecompiled.__using__/2
lib/beaver/mlir/capi.ex:37: (module)
Philip Sampaio commented
@jackalcooper would you mind to share the code or give more details?
Shenghang Tsai commented
- this is the files to get archived in the tar
a .
a ./libMLIRBeaver.dylib
a ./.DS_Store
a ./objects-RelWithDebInfo
a ./libMLIRCAPIElixir.a
a ./libMLIRBeaver.a
a ./libbeaver-v0.2.4-nif-2.16-aarch64-apple-darwin.so
a ./libbeaver-v0.2.4-nif-2.16-aarch64-apple-darwin.dylib
a ./libMLIRElixir.a
a ./objects-RelWithDebInfo/.DS_Store
a ./objects-RelWithDebInfo/obj.MLIRCAPIElixir
a ./objects-RelWithDebInfo/obj.MLIRCAPIElixir/Elixir.cpp.o
a kinda-functions-libbeaver-v0.2.4-nif-2.16-aarch64-apple-darwin.ex
./libbeaver-v0.2.4-nif-2.16-aarch64-apple-darwin.so
is a symlink to./libbeaver-v0.2.4-nif-2.16-aarch64-apple-darwin.dylib
- It leads to the
{'[a path to an unsafe symlink]', :unsafe_symlink}
error inrustler_precompiled
== Compilation error in file lib/beaver/mlir/capi.ex ==
** (Protocol.UndefinedError) protocol String.Chars not implemented for {'[source dir]/_build/test/native-install/lib/libbeaver-v0.2.4-nif-2.16-aarch64-apple-darwin.dylib', :unsafe_symlink} of type Tuple
(elixir 1.14.0) lib/string/chars.ex:3: String.Chars.impl_for!/1
(elixir 1.14.0) lib/string/chars.ex:22: String.Chars.to_string/1
(rustler_precompiled 0.5.2) lib/rustler_precompiled.ex:126: RustlerPrecompiled.__using__/2
lib/beaver/mlir/capi.ex:37: (module)
- this error is not properly converted to string when raising the exception
Philip Sampaio commented
@jackalcooper can you check if you are publishing the package correctly? You shouldn't include the compiled files in your package, because you can't guarantee that the user is running in the same architecture as you are.
If you can create a small package reproducing the issue, would be easier to investigate.
Shenghang Tsai commented
close because a workaround is found