1. 18 May, 2022 1 commit
    • Philip Withnall's avatar
      glib: Add SPDX license headers automatically · 70ee43f1
      Philip Withnall authored
      
      
      Add SPDX license (but not copyright) headers to all files which follow a
      certain pattern in their existing non-machine-readable header comment.
      
      This commit was entirely generated using the command:
      ```
      git ls-files glib/*.[ch] | xargs perl -0777 -pi -e 's/\n \*\n \* This library is free software; you can redistribute it and\/or\n \* modify it under the terms of the GNU Lesser General Public/\n \*\n \* SPDX-License-Identifier: LGPL-2.1-or-later\n \*\n \* This library is free software; you can redistribute it and\/or\n \* modify it under the terms of the GNU Lesser General Public/igs'
      ```
      Signed-off-by: Philip Withnall's avatarPhilip Withnall <pwithnall@endlessos.org>
      
      Helps: #1415
      70ee43f1
  2. 28 Apr, 2022 1 commit
    • Philip Withnall's avatar
      gmessages: Clear address before passing it to getpeername() · 7a1a9259
      Philip Withnall authored
      
      
      This will probably make no functional difference, but will squash a
      warning from scan-build:
      ```
      ../../../../source/glib/glib/gmessages.c:2243:42: warning: The left operand of '==' is a garbage value [core.UndefinedBinaryOperatorResult]
        if (err == 0 && addr.storage.ss_family == AF_UNIX)
                        ~~~~~~~~~~~~~~~~~~~~~~ ^
      ```
      
      It seems like a reasonable thing to warn about. Initialising the full
      union to zero should avoid any possibility of undefined behaviour like
      that.
      Signed-off-by: Philip Withnall's avatarPhilip Withnall <pwithnall@endlessos.org>
      
      Helps: #1767
      7a1a9259
  3. 25 Apr, 2022 1 commit
  4. 04 Mar, 2022 1 commit
  5. 03 Mar, 2022 1 commit
  6. 20 Feb, 2022 1 commit
  7. 26 Jan, 2022 1 commit
  8. 16 Nov, 2021 1 commit
  9. 15 Oct, 2021 1 commit
  10. 02 Aug, 2021 1 commit
  11. 05 Jan, 2021 1 commit
  12. 07 Oct, 2020 2 commits
    • Simon McVittie's avatar
      gmessages: Expose our default filtering as API · b17b537a
      Simon McVittie authored and Philip Withnall's avatar Philip Withnall committed
      This allows programs that want to change how log messages are printed,
      such as gnome-terminal (gnome-terminal#42
      
      ) and Flatpak, to override
      the log-writer or the legacy log-handler without having to reimplement
      the G_MESSAGES_DEBUG filtering logic.
      Signed-off-by: Simon McVittie's avatarSimon McVittie <smcv@collabora.com>
      b17b537a
    • Simon McVittie's avatar
      gmessages: Add API to move info and debug messages to stderr · 10b0ece9
      Simon McVittie authored and Philip Withnall's avatar Philip Withnall committed
      GLib code normally prints info and debug messages to stdout,
      but that interferes with programs that are documented to produce
      machine-readable output such as JSON or XML on stdout. In particular,
      if such a program uses a GLib-based library, setting G_MESSAGES_DEBUG
      will typically result in that library's debug messages going to the
      program's stdout and corrupting the machine-readable output.
      
      Unix programs can avoid this by using dup2() to move the original stdout
      to another fd, then dup2() again to make the new stdout a copy of stderr,
      but it's easier if we provide a way to not write debug messages to
      stdout in the first place. Calling
      g_log_writer_default_set_use_stderr (TRUE) results in behaviour
      resembling Python's logging.basicConfig(), with all diagnostics going
      to stderr.
      
      Suggested by Allison Karlitskaya on #2087
      
      .
      Signed-off-by: Simon McVittie's avatarSimon McVittie <smcv@collabora.com>
      10b0ece9
  13. 06 Oct, 2020 1 commit
  14. 12 Jun, 2020 1 commit
    • Philip Withnall's avatar
      tree: Fix various typos and outdated terminology · 00bfb3ab
      Philip Withnall authored
      This was mostly machine generated with the following command:
      ```
      codespell \
          --builtin clear,rare,usage \
          --skip './po/*' --skip './.git/*' --skip './NEWS*' \
          --write-changes .
      ```
      using the latest git version of `codespell` as per [these
      instructions](https://github.com/codespell-project/codespell#user-content-updating
      
      ).
      
      Then I manually checked each change using `git add -p`, made a few
      manual fixups and dropped a load of incorrect changes.
      
      There are still some outdated or loaded terms used in GLib, mostly to do
      with git branch terminology. They will need to be changed later as part
      of a wider migration of git terminology.
      
      If I’ve missed anything, please file an issue!
      Signed-off-by: Philip Withnall's avatarPhilip Withnall <withnall@endlessm.com>
      00bfb3ab
  15. 05 Sep, 2019 1 commit
  16. 26 Aug, 2019 1 commit
  17. 27 May, 2019 1 commit
  18. 23 Nov, 2018 1 commit
  19. 12 Nov, 2018 1 commit
    • Will Thompson's avatar
      gmessages: don't memoize in g_log_writer_is_journald() · f1175704
      Will Thompson authored
      Previously, g_log_writer_is_journald() would cache the result for the
      first (non-negative) FD it was called on, and return that result for
      all future (non-negative) FDs. While unlikely, it's possible that
      applications might call this function on something other than
      fileno(stderr).
      
      Move the memoization into g_log_writer_default(), which always passes
      fileno(stderr).
      
      Fixes #1589.
      f1175704
  20. 22 Aug, 2018 1 commit
  21. 29 May, 2018 1 commit
  22. 25 Apr, 2018 1 commit
  23. 23 Apr, 2018 1 commit
  24. 06 Feb, 2018 1 commit
  25. 02 Feb, 2018 1 commit
    • Philip Withnall's avatar
      gmessages: Fix -Wformat warnings for g_message() and friends · 32cc60db
      Philip Withnall authored
      
      
      When compiling with G_LOG_USE_STRUCTURED, g_message(), g_debug(), etc.
      use g_log_structured(). The message format string and its format
      arguments are passed as the final set of arguments in a longer varargs
      list, which includes the log domain and level (and other) fields.
      Passing the message format in this way means it’s not possible for the
      compiler to know to check its format placeholders when compiling with
      -Wformat.
      
      Fix support for this by adding a new semi-private helper function,
      _g_log_structured_standard(), which only uses varargs for the message
      format and its arguments, and uses fixed arguments for the other fields.
      This is then converted to a set of GLogFields and passed to
      g_log_structured() as normal.
      
      Support for -Wformat when compiling *without* G_LOG_USE_STRUCTURED was
      never broken.
      Signed-off-by: Philip Withnall's avatarPhilip Withnall <withnall@endlessm.com>
      
      https://bugzilla.gnome.org/show_bug.cgi?id=793074
      32cc60db
  26. 15 Jan, 2018 1 commit
  27. 08 Jan, 2018 1 commit
  28. 02 Dec, 2017 1 commit
  29. 10 Nov, 2017 1 commit
  30. 03 Nov, 2017 1 commit
  31. 09 Oct, 2017 1 commit
  32. 06 Oct, 2017 2 commits
  33. 22 Sep, 2017 1 commit
  34. 13 Sep, 2017 1 commit
  35. 18 Aug, 2017 1 commit
    • INSUN PYO's avatar
      glog: fix crash on Linux without stderr stream · 15faf0ef
      INSUN PYO authored and Philip Withnall's avatar Philip Withnall committed
      0  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:58
      1  0xb67c43f0 in __GI_abort () at abort.c:89
      2  0xb69ee9d8 in _g_log_abort (breakpoint=2, breakpoint@entry=1) at gmessages.c:548
      3  0xb69ef692 in g_logv (log_domain=0xb6a1dfc8 "GLib", log_level=-1254563840, log_level@entry=G_LOG_LEVEL_CRITICAL, format=format@entry=0xb6a26a48 "%s: assertion '%s' failed", args=..., args@entry=...) at gmessages.c:1357
      4  0xb69ef728 in g_log (log_domain=<optimized out>, log_level=log_level@entry=G_LOG_LEVEL_CRITICAL, format=0xb6a26a48 "%s: assertion '%s' failed") at gmessages.c:1398
      5  0xb69efa5a in g_return_if_fail_warning (log_domain=<optimized out>, pretty_function=<optimized out>, expression=<optimized out>) at gmessages.c:2687
      6  0xb69efe7c in g_log_writer_is_journald (output_fd=-1) at gmessages.c:2122
      7  0xb69f02a2 in g_log_writer_default (log_level=G_LOG_LEVEL_CRITICAL, fields=0xbedc9d00, n_fields=4, user_data=0x0) at gmessages.c:2584
      8  0xb69ef21a in g_log_structured_array (log_level=G_LOG_LEVEL_CRITICAL, fields=0xbedc9d00, n_fields=4) at gmessages.c:1933
      9  0xb69ef47e in g_log_default_handler (log_domain=0xb6a1dfc8 "GLib", log_level=G_LOG_LEVEL_CRITICAL, message=<optimized out>, unused_data=<optimized out>) at gmessages.c:3036
      10 0xb69ef5fc in g_logv (log_domain=0xb6a1dfc8 "GLib", log_level=log_level@entry=G_LOG_LEVEL_CRITICAL, format=format@entry=0xb6a26a48 "%s: assertion '%s' failed", args=..., args@entry=...) at gmessages.c:1336
      11 0xb69ef728 in g_log (log_domain=<optimized out>, log_level=log_level@entry=G_LOG_LEVEL_CRITICAL, format=0xb6a26a48 "%s: assertion '%s' failed") at gmessages.c:1398
      12 0xb69efa5a in g_return_if_fail_warning (log_domain=<optimized out>, pretty_function=<optimized out>, expression=<optimized out>) at gmessages.c:2687
      
      If stderr is not associated with an output stream, the fileno(stderr) returned is -1.
      So, g_return_if_fail_warning is recursively called and the abort occurs on the second call.
      
      Modified by Philip Withnall to include mention this in the
      documentation.
      
      https://bugzilla.gnome.org/show_bug.cgi?id=786452
      15faf0ef
  36. 20 Jul, 2017 1 commit
  37. 14 Jun, 2017 1 commit
  38. 24 May, 2017 1 commit
    • Sébastien Wilmet's avatar
      glib/: LGPLv2+ -> LGPLv2.1+ · f9faac76
      Sébastien Wilmet authored
      All glib/*.{c,h} files have been processed, as well as gtester-report.
      
      12 of those files are not licensed under LGPL:
      
      	gbsearcharray.h
      	gconstructor.h
      	glibintl.h
      	gmirroringtable.h
      	gscripttable.h
      	gtranslit-data.h
      	gunibreak.h
      	gunichartables.h
      	gunicomp.h
      	gunidecomp.h
      	valgrind.h
      	win_iconv.c
      
      Some of them are generated files, some are licensed under a BSD-style
      license and win_iconv.c is in the public domain.
      
      Sub-directories inside glib/:
      
      	deprecated/: processed in a previous commit
      	glib-mirroring-tab/: already LGPLv2.1+
      	gnulib/: not modified, the code is copied from gnulib
      	libcharset/: a copy
      	pcre/: a copy
      	tests/: processed in a previous commit
      
      https://bugzilla.gnome.org/show_bug.cgi?id=776504
      f9faac76