JuliaIO / GZip.jl

A Julia interface for gzip functions in zlib
https://juliaio.github.io/GZip.jl/dev
MIT License
39 stars 30 forks source link

Inconsistent error for file not found #106

Closed tgalery closed 9 months ago

tgalery commented 1 year ago

Heya 👋🏽 thanks for making the lib available. This is more of a question, but it took some time in the afternoon. Due to some relative path mistakes, I had some tests (that required the decompression of a gzip file passing locally), but failing on CI, which returned this message:

could not load library "libc"
  /usr/lib/x86_64-linux-gnu/libc.so: invalid ELF header

which seems to be coming from this line

Digging deeper, it seems that there is a slight difference from Oses (below tests in ubuntu 22.04 in WSL2):

julia> unsafe_load(cglobal((:errno, :libc), Cint))
ERROR: could not load library "libc"
libc.so: cannot open shared object file: No such file or directory
Stacktrace:
 [1] top-level scope
   @ REPL[1]:1

julia> cglobal((:errno, "libc.so.6"), Cint)
Ptr{Int32} @0x00007f4cbe436038

A colleague using pop os and arch reported an error similar to the ELF header above.

Instead, shouldn't we use:

using Base.Libc
errno()

to report the error number in that block