Skip to content
Snippets Groups Projects
  1. Aug 02, 2024
  2. Aug 01, 2024
  3. Jul 31, 2024
  4. Jul 26, 2024
  5. Jul 25, 2024
    • Simon McVittie's avatar
      logger: Propagate error through _srt_syslog_level_parse · 0708ef7a
      Simon McVittie authored
      
      If parsing fails, we'd like to know why.
      
      Signed-off-by: default avatarSimon McVittie <smcv@collabora.com>
      0708ef7a
    • Simon McVittie's avatar
      logger: Add an early call to g_ascii_strtoull() to avoid a GLib bug · 85ab034a
      Simon McVittie authored
      
      There is a difficult-to-reproduce failure mode in which
      g_ascii_string_to_unsigned() can fail to parse a valid integer, which
      was causing our tests to fail (but only on i386 and only in a specific
      non-interactive build environment). As far as I can make out, this is
      an error-handling issue in the way g_ascii_string_to_unsigned() calls
      g_ascii_strtoull(): if newlocale() clobbers errno (which it is within
      its rights to do, according to the usual errno conventions), then
      g_ascii_strtoull() would interpret that as a strtoull_l() failure.
      
      We can work around this by ensuring that our first call to
      g_ascii_strtoull() is one that doesn't matter, so that by the time we
      actually call g_ascii_string_to_unsigned(), the cached C locale object
      inside GLib has already been initialized.
      
      steamrt/tasks#481
      
      Signed-off-by: default avatarSimon McVittie <smcv@collabora.com>
      85ab034a
    • Simon McVittie's avatar
      Add test coverage for _srt_syslog_level_parse() · 8f2d8c9e
      Simon McVittie authored
      
      steamrt/tasks#481
      
      Signed-off-by: default avatarSimon McVittie <smcv@collabora.com>
      8f2d8c9e
    • Simon McVittie's avatar
      tests: Add sample code to print GLib messages with a priority prefix · de2f4173
      Simon McVittie authored
      
      Something similar to this could be used inside `steamwebhelper` and
      other Steam executables that are linked to GLib, if desired.
      
      Followup for steamrt/tasks#444.
      
      Typical output:
      
      ```
      <3>priority-logwriter [main] internal error: this is a mockup of a critical warning
      <4>priority-logwriter [main] warning: this is a mockup of an ordinary warning
      <5>priority-logwriter [main] this is a mockup of a somewhat important message
      <5>priority-logwriter [main] this message
      <5>contains
      <5>multiple
      <5>lines
      <6>priority-logwriter [main] this is a mockup of an informational message
      <7>priority-logwriter [main] this is a mockup of a debug message
      <3>priority-logwriter [MyLib] (old log API) internal error: this is a mockup of a critical warning from a library
      <4>priority-logwriter [MyLib] (old log API) warning: this is a mockup of an ordinary warning from a library
      <5>priority-logwriter [MyLib] (old log API) this is a mockup of a somewhat important message from a library
      <5>priority-logwriter [MyLib] (old log API) this message
      <5>contains
      <5>multiple
      <5>lines
      <6>priority-logwriter [MyLib] (old log API) this is a mockup of an informational message from a library
      <7>priority-logwriter [MyLib] (old log API) this is a mockup of a debug message from a library
      <5>priority-logwriter [MyLib] Structured message: Invalid cross-device link [errno 18]
      ```
      
      Signed-off-by: default avatarSimon McVittie <smcv@collabora.com>
      de2f4173
    • Simon McVittie's avatar
      log: Optionally prepend a priority level marker to each message · 80bdc480
      Simon McVittie authored
      
      If we're running under `srt-logger --parse-level-prefix`, it becomes
      useful for our tools to emit priority level markers on their diagnostic
      messages. In particular, we want pressure-vessel to tag its warning and
      error messages with one of these markers.
      
      Signed-off-by: default avatarSimon McVittie <smcv@collabora.com>
      80bdc480
    • Simon McVittie's avatar
  6. Jul 24, 2024
  7. Jul 23, 2024
  8. Jul 22, 2024
  9. Jul 19, 2024
    • Ryan Gonzalez's avatar
      test-logger: Add tests for level prefix parsing · 02340efe
      Ryan Gonzalez authored
      
      This adds several tests to exercise the functionality, notably
      including tests for the buffering.
      
      steamrt/tasks#444
      
      Signed-off-by: default avatarRyan Gonzalez <ryan.gonzalez@collabora.com>
      02340efe
    • Ryan Gonzalez's avatar
      logger: Forward log levels to the journal · 3fc8c0df
      Ryan Gonzalez authored
      
      steamrt/tasks#444
      
      Signed-off-by: default avatarRyan Gonzalez <ryan.gonzalez@collabora.com>
      3fc8c0df
    • Ryan Gonzalez's avatar
      logger: Color messages logged to the terminal based on their level · 6bc1cbad
      Ryan Gonzalez authored
      
      The colors used follow systemd's journal log coloring.
      
      steamrt/tasks#444
      
      Signed-off-by: default avatarRyan Gonzalez <ryan.gonzalez@collabora.com>
      6bc1cbad
    • Ryan Gonzalez's avatar
      logger: Parse log line prefixes and use them for target filtering · 14750a31
      Ryan Gonzalez authored
      
      This adds the ability to parse syslog prefixes from log lines by passing
      --parse-level-prefix to srt-logger. The corresponding lines will then be
      filtered based on the newly added --[journal/file/terminal]-level
      options.
      
      The presence of prefixes means that, when we start reading part of a
      line, it can no longer be sent out immediately, because it might be part
      of a level prefix that needs to be stripped off. To solve this, the
      parser code now does a *partial* buffering of all output: it will buffer
      log data until it is certain that it is *not* part of a level prefix, at
      which point all buffered data will be sent out to the otherwise
      unbuffered outputs (terminal/stderr), even if a newline hasn't been
      read yet.
      
      steamrt/tasks#444
      
      Signed-off-by: default avatarRyan Gonzalez <ryan.gonzalez@collabora.com>
      14750a31
    • Simon McVittie's avatar
      Merge branch 'wip/task477' into 'main' · 7c58bfcd
      Simon McVittie authored
      pv-runtime: Try to mount /usr/${LIB}/gconv into container
      
      See merge request !726
      7c58bfcd
    • Simon McVittie's avatar
      pv-runtime: Try to mount /usr/${LIB}/gconv into container · 744fecda
      Simon McVittie authored
      
      Previously we assumed that the hard-coded directory used to dlopen
      gconv modules matched the realpath() of the directory containing
      libc.so.6, disregarding any compatibility symlinks: for example, on
      Red Hat, 64-bit gconv modules are in /usr/lib64/gconv, and on Debian
      they're in /usr/lib/x86_64-linux-gnu/gconv.
      
      However, this turns out not to be true on Void Linux, where
      /usr/lib64 -> lib is a non-canonical path, but the hard-coded path
      that will be used to load iconv modules is /usr/lib64/gconv anyway.
      
      We cannot simply set GCONV_PATH, because apparently setting
      `GCONV_PATH=/usr/lib/gconv:/usr/lib32/gconv` will break 32-bit
      applications: unlike the equivalent with LD_LIBRARY_PATH, a 32-bit
      application would try and fail to load the 64-bit module from
      /usr/lib/gconv (it will fail to load because its word size does not
      match the word size of the process), and then will not fall back to
      /usr/lib32/gconv as one might expect.
      
      Luckily, on Void Linux, the libdl dynamic string token ${LIB} has been
      chosen such that the correct path for each architecture's gconv modules
      is /usr/${LIB}/gconv. We can use this as an additional guess at the
      necessary mount point for the gconv modules, mounting /usr/lib/gconv
      onto both /usr/lib/gconv and /usr/lib64/gconv - that way, it doesn't
      matter whether the path hard-coded in glibc matches our old heuristic
      or our new heuristic, because either one will work.
      
      steamrt/tasks#477, ValveSoftware/steam-runtime#680
      
      Signed-off-by: default avatarSimon McVittie <smcv@collabora.com>
      744fecda
  10. Jul 18, 2024
Loading