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

sync with upstream #141

Merged
merged 10 commits into from
Jan 6, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 12 additions & 3 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,17 @@
## Fixes/improvements

* [#3731] Fix string.format() omission in OpenOS package.lua.
* [#3735] Fix server hangs on long-lasting HTTP requests.
* [#3703] Fix potential packet memory leak.
* [#3729] Fix potential crash when opening the manual.
* Added a configuration option for network packet TTL. (Timothé GRISOT)
* Improved mod load times on certain platforms. (charagarland)
* Updated Chinese translation. (HfSr)
* Updated Unifont to 16.0.02.

## OpenOS fixes/improvements

* [#3714] Fix an OpenOS 1.8.0 regression causing event.pullFiltered() to effectively ignore filter timeouts.
* [#3727] Fix an exception handler bug in process.lua, uncovered by fixing recursive xpcall() handling in 1.8.4.

## List of contributors

asie, REUSS-dev
asie, charagarland, DragDen, HfSr, Timothé GRISOT
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
-- called from /init.lua
local raw_loadfile = ...

_G._OSVERSION = "OpenOS 1.8.6"
_G._OSVERSION = "OpenOS 1.8.7"

-- luacheck: globals component computer unicode _OSVERSION
local component = component
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,8 +140,13 @@ function event.pullFiltered(...)
filter = args[2]
end

local deadline = computer.uptime() + (seconds or math.huge)
repeat
local signal = table.pack(computer.pullSignal(seconds))
local waitTime = deadline - computer.uptime()
if waitTime <= 0 then
break
end
local signal = table.pack(computer.pullSignal(waitTime))
if signal.n > 0 then
if not (seconds or filter) or filter == nil or filter(table.unpack(signal, 1, signal.n)) then
return table.unpack(signal, 1, signal.n)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,15 +68,19 @@ function process.load(path, env, init, name)
if type(msg) == "table" and msg.reason == "terminated" then
return msg.code or 0
end
local stack = debug.traceback():gsub("^([^\n]*\n)[^\n]*\n[^\n]*\n","%1")
io.stderr:write(string.format("%s:\n%s", msg or "", stack))
return 128 -- syserr
return debug.traceback()
end, ...)
}

--result[1] is false if the exception handler also crashed
if not result[1] and type(result[2]) ~= "number" then
io.stderr:write("process library exception handler crashed: ", tostring(result[2]))
-- run exception handler
xpcall(function()
local stack = result[2]:gsub("^([^\n]*\n)[^\n]*\n[^\n]*\n","%1")
io.stderr:write(string.format("%s:\n%s", msg or "", stack))
end,
function(msg)
io.stderr:write("process library exception handler crashed: ", tostring(msg))
end)
end

-- onError opens a file, you can't open a file without a process, we close the process last
Expand Down