]> git.e2factory.org Git - e2factory.git/commitdiff
Fix e2factory sometimes ignoring Control-C
authorTobias Ulmer <tu@emlix.com>
Fri, 6 Jan 2017 19:01:48 +0000 (20:01 +0100)
committerTobias Ulmer <tu@emlix.com>
Fri, 6 Jan 2017 19:01:48 +0000 (20:01 +0100)
Signed-off-by: Tobias Ulmer <tu@emlix.com>
Changelog
generic/e2lib.lua
generic/eio.lua
local/digest.lua

index 7fe79a3d46210fe35d4bb898a6659511f4291b44..1e73b7d80a80e19d3ab160db0a23c439eb375219 100644 (file)
--- 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
index 3db930cf7cc6ac8a54115e985fc8c4533648ca57..35cae72a3d9c8977e35f6ee87e60ada19a61897e 100644 (file)
@@ -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
index 082b8b0a8fd9d48e2cb51fc69cba5b94aaefa8d7..a6689859f20406141e038ef91ca08de8421f2121 100644 (file)
@@ -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
 
index dd48db7674b5d16aeceecdb7f0477758cbcea642..81ecbaf5df0439bf92e3f8c43a57e86f5cd86b75 100644 (file)
@@ -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