MINGW-packages icon indicating copy to clipboard operation
MINGW-packages copied to clipboard

[lua, lua53] use fseek solution for mingw compilers provided by Lua's author

Open luau-project opened this issue 4 months ago • 0 comments

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

  1. 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
  2. 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()
  1. Run the script on current Lua lua fseek-test.lua or Lua 5.3 lua5.3 fseek-test.lua
  2. 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).

luau-project avatar Oct 17 '24 17:10 luau-project