1. 25 Nov, 2020 1 commit
  2. 20 Nov, 2020 3 commits
  3. 18 Nov, 2020 1 commit
    • Philip Withnall's avatar
      tests: Improve validity of binary GDBusMessage parsing tests · f936bba0
      Philip Withnall authored
      These tests were originally written using the output directly from a
      fuzzer which had triggered the bugs we’re testing for. However, that
      means they’re liable to no longer test what they’re intended to test if
      the `GDBusMessage` parsing code is changed to (for example) check for
      certain errors earlier in future.
      It’s better to only have one invalidity in each binary blob, so change
      the test messages to all be valid apart from the specific thing they’re
      testing for.
      The changes were based on reading the D-Bus specification directly:
      During these changes I found one problem in
      `test_message_parse_deep_header_nesting()` where it wasn’t actually
      nesting variants in the header deeply enough to trigger the bug it was
      supposed to be testing for. Fixed that.
      Signed-off-by: Philip Withnall's avatarPhilip Withnall <pwithnall@endlessos.org>
      Fixes: #1963
  4. 17 Nov, 2020 2 commits
  5. 15 Nov, 2020 1 commit
  6. 14 Nov, 2020 2 commits
  7. 31 Oct, 2020 5 commits
  8. 28 Oct, 2020 1 commit
    • Simon McVittie's avatar
      gio/tests/gdbus-peer: Exercise fds attached to a large message · e5cee9ce
      Simon McVittie authored
      This incidentally also exercises the intended pattern for sending fds in
      a D-Bus message: the fd list is meant to contain exactly those fds that
      are referenced by a handle (type 'h') in the body of the message, with
      numeric handle value n corresponding to g_unix_fd_list_peek_fds(...)[n].
      Being able to send and receive file descriptors that are not referenced by
      a handle (as in OpenFile here) is a quirk of the GDBus API, and while it's
      entirely possible in the wire protocol, other D-Bus implementations like
      libdbus and sd-bus typically don't provide APIs that make this possible.
      Reproduces: #2074Signed-off-by: Simon McVittie's avatarSimon McVittie <smcv@collabora.com>
  9. 26 Oct, 2020 1 commit
    • Michael Catanzaro's avatar
      Fix race in socketclient-slow test · 1d28fd53
      Michael Catanzaro authored
      This test ensures that g_socket_client_connect_to_host_async() fails if
      it is cancelled, but it's not cancelled until after 1 millisecond. Our
      CI testers are hitting that race window, and Milan is able to reproduce
      the crash locally as well. Switching it from 1ms to 0ms is enough for
      Milan to avoid the crash, but not enough for our CI, so let's move the
      cancellation to a GSocketClientEvent callback where the timing is
      completely deterministic.
      Hopefully fixes #2221
  10. 12 Oct, 2020 1 commit
    • Sergio Costas's avatar
      GSubprocessLauncher: allow to close passed FDs · c12762a0
      Sergio Costas authored
      By default, when using g_subprocess_launcher_take_fd() to pass an
      FD to a child, the GSubprocessLauncher object also takes ownership
      of the FD in the parent, and closes it during finalize(). This is
      a reasonable assumption in the majority of the cases, but sometimes
      it isn't a good idea.
      An example is when creating a GSubprocessLauncher in JavaScript:
      here, the destruction process is managed by the Garbage Collector,
      which means that those sockets will remain opened for some time
      after all the references to the object has been droped. This means
      that it could be not possible to detect when the child has closed
      that same FD, because in order to make that work, both FDs
      instances (the one in the parent and the one in the children) must
      be closed. This can be a problem in, as an example, a process that
      launches a child that communicates with Wayland using an specific
      socket (like when using the new API MetaWaylandClient).
      Of course, it isn't a valid solution to manually call close() in
      the parent process just after the call to spawn(), because the FD
      number could be reused in the time between it is manually closed,
      and when the object is destroyed and closes again that FD. If that
      happens, it will close an incorrect FD.
      One solution could be to call run_dispose() from Javascript on the
      GSubprocessLauncher object, to force freeing the resources.
      Unfortunately, the current code frees them in the finalize()
      method, not in dispose() (this is fixed in !1670 (merged) ) but it
      isn't a very elegant solution.
      This proposal adds a new method, g_subprocess_launcher_close(),
      that allows to close the FDs passed to the child. To avoid problems,
      after closing an FD with this method, no more spawns are allowed.
      Fix: !1677
  11. 06 Oct, 2020 1 commit
    • gentoo-root's avatar
      gio: Expose g_file_build_attribute_list_for_copy · 094eca70
      gentoo-root authored
      Expose a function that prepares an attribute query string to be passed
      to g_file_query_info() to get a list of attributes normally copied with
      the file. This function is used by the implementation of
      g_file_copy_attributes, and it's useful if one needs to split
      g_file_copy_attributes into two stages, for example, when nautilus does
      a recursive move of a directory. When files are moved from the source
      directory, its modification time changes. To preserve the mtime on the
      destination directory, it has to be queried before moving files and set
      after doing it, hence these two stages.
      Signed-off-by: gentoo-root's avatarMaxim Mikityanskiy <maxtram95@gmail.com>
  12. 01 Oct, 2020 3 commits
  13. 30 Sep, 2020 1 commit
    • Philip Withnall's avatar
      guri: Fix URI scope parsing · b43fb9cb
      Philip Withnall authored
      The previous parsing code could read off the end of a URI if it had an
      incorrect %-escaped character in.
      Fix that, and more closely implement parsing for the syntax defined in
      RFC 6874, which is the amendment to RFC 3986 which specifies zone ID
      This requires reworking some network-address tests, which were
      previously treating zone IDs incorrectly.
      Signed-off-by: Philip Withnall's avatarPhilip Withnall <pwithnall@endlessos.org>
  14. 28 Aug, 2020 1 commit
    • Carlos Garnacho's avatar
      tests: Add splice cancellation test · cf85241a
      Carlos Garnacho authored
      This doesn't trigger the cancellation assertion issue when run locally
      (the task didn't return yet, so the error is simply overwritten), but
      perhaps it ever does in CI. Anyhow, it's good to have a cancellation
  15. 17 Aug, 2020 1 commit
    • Andre Miranda's avatar
      glocalfileinfo: Add statx() support · 60eefd4d
      Andre Miranda authored
      This currently just implements the same functionality as the existing
      `stat()`/`fstat()`/`fstatat()`/`lstat()` calls, although where a reduced
      field set is requested it may return faster.
      Helps: #1970
  16. 24 Jul, 2020 1 commit
  17. 25 Jun, 2020 6 commits
  18. 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
      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>
  19. 10 Jun, 2020 1 commit
    • Simon McVittie's avatar
      Normalize C source files to end with exactly one newline · 44c004c8
      Simon McVittie authored
      Some editors automatically remove trailing blank lines, or
      automatically add a trailing newline to avoid having a trailing
      non-blank line that is not terminated by a newline. To avoid unrelated
      whitespace changes when users of such editors contribute to GLib,
      let's pre-emptively normalize all files.
      Unlike more intrusive whitespace normalization like removing trailing
      whitespace from each line, this seems unlikely to cause significant
      issues with cherry-picking changes to stable branches.
      Implemented by:
          find . -name '*.[ch]' -print0 | \
          xargs -0 perl -0777 -p -i -e 's/\n+\z//g; s/\z/\n/g'
      Signed-off-by: Simon McVittie's avatarSimon McVittie <smcv@collabora.com>
  20. 28 May, 2020 1 commit
  21. 22 May, 2020 2 commits
  22. 20 May, 2020 1 commit
    • Philip Withnall's avatar
      tests: Speed up the cancellable test · 9f27f49e
      Philip Withnall authored
      The test added for #1841 spawned 100000 threads. That was fine on a
      desktop machine, but on a heavily loaded CI machine, it could result in
      large (and unpredictable) slowdowns, resulting in the test taking over
      120s in about 1 in 5 runs, and hence failing that CI pipeline due to a
      timeout. When passing normally on CI, the test would take around 90s.
      Here’s a histogram of time per iteration on a failing (timed out) test
      run. Each iteration is one thread spawn:
        Iteration duration (µs) | Frequency
                           ≤100 |     0
                        100–200 | 30257
                        200–400 | 13696
                        400–800 |  1046
                       800–1000 |   123
                      1000–2000 |   583
                      2000–4000 |  3779
                      4000–8000 |  4972
                     8000–10000 |  1027
                    10000–20000 |  2610
                    20000–40000 |   650
                    40000–80000 |    86
                   80000–100000 |    10
                  100000–200000 |     2
                        >200000 |     0
      There’s no actual need for the test to spawn 100000 threads, so rewrite
      it to reuse a single thread, and pass new data to that thread.
      Reverting the original commit (e4a690f5) reproduces the failure on
      100 out of 100 test runs with this commit applied, so the test still
      The test now takes 3s, rather than 11s, to run on my computer, and has
      passed when run with `meson test --repeat 1000 cancellable`.
      Signed-off-by: Philip Withnall's avatarPhilip Withnall <withnall@endlessm.com>
  23. 07 May, 2020 2 commits