From: Tobias Ulmer Date: Fri, 6 Jan 2017 19:01:48 +0000 (+0100) Subject: Fix e2factory sometimes ignoring Control-C X-Git-Tag: e2factory-2.3.16rc1~3 X-Git-Url: https://git.e2factory.org/?a=commitdiff_plain;h=960c18d96e52edc364db8a983fc070dc4fc3c1d1;p=e2factory.git Fix e2factory sometimes ignoring Control-C Signed-off-by: Tobias Ulmer --- diff --git a/Changelog b/Changelog index 7fe79a3..1e73b7d 100644 --- a/Changelog +++ b/Changelog @@ -1,4 +1,5 @@ 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 diff --git a/generic/e2lib.lua b/generic/e2lib.lua index 3db930c..35cae72 100644 --- a/generic/e2lib.lua +++ b/generic/e2lib.lua @@ -362,6 +362,7 @@ end -- -- 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 @@ -374,7 +375,7 @@ function e2lib.init() e2lib.log(4, "e2lib.init()") console.open() - trace.enable() + trace.install() trace.default_filter() local rc, re = e2lib.signal_reset() @@ -569,7 +570,7 @@ end -- @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 @@ -603,7 +604,7 @@ function e2lib.log(level, msg, nonewline) console.eout(msg) end end - trace.enable() + trace.on() end --- Rotate log file. @@ -2033,17 +2034,17 @@ function e2lib.mkdir_recursive(path, mode) 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 diff --git a/generic/eio.lua b/generic/eio.lua index 082b8b0..a668985 100644 --- a/generic/eio.lua +++ b/generic/eio.lua @@ -277,23 +277,23 @@ 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 diff --git a/local/digest.lua b/local/digest.lua index dd48db7..81ecbaf 100644 --- a/local/digest.lua +++ b/local/digest.lua @@ -304,9 +304,9 @@ local function compute_sha1_checksum(filename) 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 @@ -373,9 +373,9 @@ local function compute_sha256_checksum(filename) 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