NEXT:
+ * Fix e2factory sometimes ignoring Control-C
* Fix unintended modification of the git index in working source directory.
* Add sha256 support to e2source file config
* Add sha256 support to e2licence config
--
-- le2lib sets up a SIGINT handler that calls back into this function.
function e2lib.interrupt_hook()
+ trace.install() -- reinstall the trace hook.
e2lib.abort("*interrupted by user*")
end
e2lib.log(4, "e2lib.init()")
console.open()
- trace.enable()
+ trace.install()
trace.default_filter()
local rc, re = e2lib.signal_reset()
-- @param msg string: log message
-- @param nonewline Defaults to false. Do not append newline if set to true.
function e2lib.log(level, msg, nonewline)
- trace.disable()
+ trace.off()
if level < 1 or level > 4 then
e2lib.log(1, "Internal error: invalid log level")
end
console.eout(msg)
end
end
- trace.enable()
+ trace.on()
end
--- Rotate log file.
eexist = errno.def2errnum("EEXIST")
- trace.disable()
+ trace.filter_function("e2lib", "mkdir")
for _,dir in ipairs(dirs) do
rc, re, errnum = e2lib.mkdir(dir, mode)
if not rc then
if errnum ~= eexist then
- trace.enable()
+ trace.filter_function_remove("e2lib", "mkdir")
return false, re
end
end
end
- trace.enable()
+ trace.filter_function_remove("e2lib", "mkdir")
return true
end
function eio.readline(file)
local rc, re, line, char
- trace.disable() -- don't spam the logs with fgetc calls.
+ trace.off() -- don't spam the logs with fgetc calls.
line = ""
while true do
char, re = eio.fgetc(file)
if not char then
- trace.enable()
+ trace.on()
return false, re
elseif char == "\0" then
-- fgets cannot handle embedded zeros, causing mayhem in C.
-- We could do this in Lua, but lets signal an error till
-- we have a use case.
- trace.enable()
+ trace.on()
return false, err.new("got NUL character while reading line")
elseif char == "\n" or char == "" then
line = line..char -- retain newline just like fgets does.
- trace.enable()
+ trace.on()
return line
end
ctx = lsha.sha1_init()
- trace.disable()
+ trace.off()
ok, rc, re = e2lib.trycall(compute_checksum, ctx, f)
- trace.enable()
+ trace.on()
eio.fclose(f)
if not ok then
ctx = lsha.sha256_init()
- trace.disable()
+ trace.off()
ok, rc, re = e2lib.trycall(compute_checksum, ctx, f)
- trace.enable()
+ trace.on()
eio.fclose(f)
if not ok then