1. 10 Apr, 2015 1 commit
  2. 05 Oct, 2014 1 commit
  3. 12 Sep, 2014 1 commit
  4. 18 Sep, 2013 1 commit
    • Michele Tartara's avatar
      Perform proper cleanup on termination of Haskell daemons · 80adbbe1
      Michele Tartara authored
      
      
      Haskell deamons did not perform proper cleanup at termination. There was no code
      for removing the pid file, and the code in LuxiD for removing the unix socket
      file was not working, because it is implemented with a "finally" statement,
      which is executed only when the main loop of the daemon is exited (either
      normally, or through an exception), but not when it is terminated by a SIGTERM.
      
      This commit adds a proper handler for SIGTERM, which transforms it into a
      successful termination exception. This allows both the newly added cleanup code
      for pid files and the unmodified cleanup code for unix sockets to be executed.
      
      Fixes Issue 581 and 582.
      Signed-off-by: default avatarMichele Tartara <mtartara@google.com>
      Reviewed-by: default avatarKlaus Aehlig <aehlig@google.com>
      80adbbe1
  5. 13 Aug, 2013 1 commit
  6. 17 Jul, 2013 1 commit
  7. 14 May, 2013 1 commit
  8. 24 Dec, 2012 1 commit
  9. 20 Nov, 2012 1 commit
    • Iustin Pop's avatar
      Properly log errors when setting up daemon FDs · 1a865afe
      Iustin Pop authored
      
      
      While writing the pipe-based reporting and trying various ways to
      break the startup, I fought for a while trying to understand why error
      reporting was _different_ when running the daemon as a user (with no
      rights). It turns out that setupDaemonFDs wants to open the log file
      in append mode way before, so we are not protected by the 'prepare'
      phase.
      
      This patch explicitly runs the 'setupDaemonFDs' function under the
      same handler as the prepare phase, with the only change that here we
      instruct handlePrepErr to not log the message via log*, since logging
      is not yet set up.
      Signed-off-by: default avatarIustin Pop <iustin@google.com>
      Reviewed-by: default avatarMichael Hanselmann <hansmi@google.com>
      1a865afe
  10. 12 Nov, 2012 6 commits
  11. 07 Nov, 2012 2 commits
    • Iustin Pop's avatar
      Implement base checkFn/prepFn/execFn model for daemons · 2ac2e420
      Iustin Pop authored
      
      
      This mirrors the code in the Python code base, and is required for
      clean error reporting during startup.
      
      This patch implements the basic infrastructure; the confd daemon is
      not yet modified to take advantage of this, just the types are
      adjusted.
      
      Also, the pipe-based error reporting will go in a future patch, once
      we can actually use that for reporting.
      Signed-off-by: default avatarIustin Pop <iustin@google.com>
      Reviewed-by: default avatarMichael Hanselmann <hansmi@google.com>
      2ac2e420
    • Iustin Pop's avatar
      Fix compatibility with newer Haskell libraries · 1251817b
      Iustin Pop authored
      
      
      This small patch fixes compatibility with a few newer Haskell libraries:
      
      - base 4.6, included with ghc 7.6, removed the deprecated 'catch'
        function from Prelude, so our "import Prelude hiding (catch)" is now
        an error; we workaround by using fully-qualified
        Control.Exception.catch name
      
      - containers 0.5 changed the signature of 'deleteFindMax'; we
        workaround by using separate 'findMax' and 'deleteMax'
      
      - QuickCheck 2.5 removed the 'maxDiscards' test parameter, replacing
        it with a much better 'maxDiscardsRatio'; however, until we can
        depend on that, we workaround by just removing it (we don't control
        anymore the maxDiscards, instead leaving it default; for our default
        test size, this is no change, as the default value is already 500,
        which is our default as well) and not printing it anymore
      
      Tested on Squeeze (+extra libs), Wheezy and experimental, which covers
      all supported GHC versions.
      
      Also, merging this in master will be a pain, but unless we want to
      stop supporting 2.6…
      Signed-off-by: default avatarIustin Pop <iustin@google.com>
      Reviewed-by: default avatarGuido Trotter <ultrotter@google.com>
      1251817b
  12. 08 Oct, 2012 3 commits
  13. 26 Sep, 2012 3 commits
  14. 05 Sep, 2012 3 commits
    • Iustin Pop's avatar
      Further hlint fixes · 5b11f8db
      Iustin Pop authored
      Commit 2cdaf225, “Re-enable standard hlint warnings”, got it almost
      right. The only problem is that (confusingly) the default set of hints
      is not in HLint.Default, but in HLint.HLint (it includes Default and
      some built-ins).
      
      After changing the lint file to correctly include the defaults, we had
      another 128 suggestions:
      
        - Error: Eta reduce (2)
        - Error: Redundant bracket (4)
        - Error: Redundant do (17)
        - Error: Redundant lambda (7)
        - Error: Redundant return (1)
        - Warning: Avoid lambda (2)
        - Warning: Redundant $ (42)
        - Warning: Redundant bracket (35)
        - Warning: Use : (1)
        - Warning: Use String (4)
        - Warning: Use camelCase (10)
        - Warning: Use section (3)
      
      which are fixed by the current patch. Note that the 10 "Use camelCase"
      were all due to hlint not “knowing” the idiom of ‘case_’ (it does for
      ‘prop_’), for which I filled
      http://code.google.com/p/ndmitchell/issues/detail?id=558
      
      .
      Signed-off-by: default avatarIustin Pop <iustin@google.com>
      Reviewed-by: default avatarRené Nussbaumer <rn@google.com>
      5b11f8db
    • Iustin Pop's avatar
      Rework CLI modules and tests · 51000365
      Iustin Pop authored
      While investigating how we could test the Daemon.hs module, I realised
      that we have a very, erm, sub-optimal situation:
      
      - HTools/CLI.hs has a nice IO/pure separation testing in cmdline
        parsing, which allows some basic functionality to be tested, but
        uses direct 'read' in many options, which fails at runtime when
        evaluating the argument, and not when parsing the options
      - Daemon.hs lacks that, but has a much nicer 'reqWithConversion'
        helper that can be used for nicer option parsing, and uses that +
        tryRead instead of plain 'read'
      
      Since this situation is very bad, let's clean it up. We introduce yet
      another module, Common.hs, that holds functionality common to all
      command line programs (daemons or not). We move the parsing to this
      module, and introduce a type class to handle option types which
      support --help/--version. This allows removal of duplicated code from
      CLI.hs and Daemon.hs.
      
      The other part of the patch is cleanup/rework of the tests for this
      code: we introduce some helpers (checkOpt, passFailOpt,
      checkEarlyExit) that can be used from the much-slimmer now tests for
      CLI and Daemon. In the common module, we just test the yes/no helper
      we have. Many new tests for boolean options and numeric options are
      added.
      
      A side change is the removal of the obsolete `--replay-count',
      `--test-size' options (unused since commit 95f6c931
      
      , “Switch Haskell
      test harness to test-framework”).
      Signed-off-by: default avatarIustin Pop <iustin@google.com>
      Reviewed-by: default avatarRené Nussbaumer <rn@google.com>
      51000365
    • Iustin Pop's avatar
      Move Version.hs up from under HTools/ · 2997cb0a
      Iustin Pop authored
      
      
      This is another module that is generic, and not htools-specific.
      Signed-off-by: default avatarIustin Pop <iustin@google.com>
      Reviewed-by: default avatarRené Nussbaumer <rn@google.com>
      2997cb0a
  15. 03 Sep, 2012 1 commit
  16. 28 Aug, 2012 1 commit
    • Iustin Pop's avatar
      Re-enable standard hlint warnings · 2cdaf225
      Iustin Pop authored
      Commit 5a1e31b4
      
       (Add infrastructure for, and two extra hlint rules)
      was intended to add two *extra* hlint rules, but I didn't realise at
      that time that "--hint" when first used overrides the built-in
      lints. As such, since then we were basically running with just those
      two rules, which resulted in many uncaught warnings/errors.
      
      This patch fixes that (by importing the standard lint rules in our
      custom hints file), and then goes to fix all the warnings that a
      current hlint gives me. Compared to our current style, we have just a
      few additions:
      
      - zipWithM instead of map foo . zip …
      - 'exitSuccess' instead of 'exitWith ExitSuccess'
      - more uses of '.'
      
      Additionally, we have to silence a case where hlint doesn't realise
      why we are using '\e -> const (return False (e :: IOError)' instead of
      just '\e -> return False' or even 'const (return False').
      
      One warning that is generated by hlint ("Use void") can't be fixed
      until we deprecate GHC 6.x, as only GHC 7 has the 'void' function in
      Control.Monad.
      Signed-off-by: default avatarIustin Pop <iustin@google.com>
      Reviewed-by: default avatarAgata Murawska <agatamurawska@google.com>
      2cdaf225
  17. 29 May, 2012 2 commits
  18. 01 May, 2012 1 commit
  19. 22 Mar, 2012 3 commits
  20. 20 Mar, 2012 1 commit
  21. 19 Mar, 2012 1 commit
  22. 13 Mar, 2012 1 commit