MINGW-packages
MINGW-packages copied to clipboard
[lua, lua53] use fseek solution for mingw compilers provided by Lua's author
Description
Around 4 months ago, in order to fix https://github.com/msys2/MINGW-packages/issues/20892, I submitted a PR https://github.com/msys2/MINGW-packages/pull/21266 that got merged with a workaround given by myself.
Today, looking for that issue in the Lua mailing list, I found that someone reported it at http://lua-users.org/lists/lua-l/2015-05/msg00315.html and got a final solution at http://lua-users.org/lists/lua-l/2015-05/msg00370.html provided by Roberto Ierusalimschy (Lua's author).
Thus, this current PR is just replacing my old solution with the one provided by Lua's author.
Tests
- You need to have any file larger than 32-bits range. By the way, I used Ubuntu 24.04 iso, which is 6.1 GB
- Write the following Lua script to a file (
fseek-test.lua
):
f = assert(io.open("ubuntu-24.04-desktop-amd64.iso"))
print(f:seek("end"))
f:close()
- Run the script on current Lua
lua fseek-test.lua
or Lua 5.3lua5.3 fseek-test.lua
- The expected result is the file size in bytes (
6114656256
for my file).
P.S.: I did test Lua's author solution provided here on mingw32, mingw64, ucrt64, clang32 and clang64, and it worked nicely (x64 machine).