Skip to content
Snippets Groups Projects
  1. Jun 01, 2020
  2. May 21, 2020
  3. Apr 03, 2020
    • Simon McVittie's avatar
      scripts: Assert that we have the desired Python version · b4f85647
      Simon McVittie authored
      
      In Steam Runtime 1 'scout' and Steam Runtime 1½ 'heavy' SDK
      environments, we have a backport of python3.5 in order to run Meson,
      and meson.build automatically selects it if available.
      
      In newer environments like a developer's laptop, we expect to have a
      strictly newer Python version, like the python3.7 in Debian 10.
      
      One notable exception is that we only require Python 3.4+ for scripts
      that are meant to run on test machines or on non-developer Steam users'
      systems, which right now just means the test UI. This version was chosen
      because SteamOS 2 'brewmaster' and Ubuntu 14.04 'trusty' both have 3.4.
      
      Ubuntu 12.04 'precise' only has 3.2, but the Steam client doesn't
      actually work on 12.04 any more for orthogonal reasons.
      
      Signed-off-by: default avatarSimon McVittie <smcv@collabora.com>
      b4f85647
  4. Feb 26, 2020
    • Simon McVittie's avatar
      utils: Add a method to copy a directory tree using hard links · 181337cd
      Simon McVittie authored
      
      This will let us duplicate a runtime and edit it in-place. The major
      appeal of doing this is that it's something we can do in a Flatpak
      environment, where recursively invoking bubblewrap isn't allowed.
      
      It also seems like it might yield a more reliable way to overwrite parts
      of the runtime with their host-system equivalents than the tricks we
      currently use with files and directories mounted over their runtime
      counterparts.
      
      The major down side is that after we've done this, we have a copy of
      the runtime, which we need to garbage-collect and clean up eventually.
      
      Signed-off-by: default avatarSimon McVittie <smcv@collabora.com>
      181337cd
  5. Nov 14, 2019
  6. Nov 12, 2019
  7. Nov 11, 2019
  8. Sep 12, 2019
  9. Aug 22, 2019
  10. Aug 16, 2019
  11. Aug 15, 2019
  12. Aug 09, 2019
  13. Jun 24, 2019
  14. May 02, 2019
  15. Mar 28, 2019
  16. Oct 16, 2017
  17. Oct 11, 2017
  18. Oct 06, 2017
    • Jonathan Lebon's avatar
      fdio: allow NULL for fstatat_allow_noent stbuf · 5362f6bc
      Jonathan Lebon authored
      Often, the caller doesn't actually care about the details of the stat
      struct itself, but just whether the entry exists or not. It does work
      to just pass `NULL` directly to glibc in a quick test, but given that
      the argument is tagged as `__nonnull` and that the documentation does
      not explicitly specify this is supported, let's do this safely.
      5362f6bc
  19. Sep 26, 2017
  20. Sep 25, 2017
    • Colin Walters's avatar
      fdio: Open target dirname for glnx_file_copy_at() · 5ee2f1be
      Colin Walters authored
      Particularly if `AT_FDCWD` is used, we need to open
      in the target dir, otherwise we can get `EXDEV` when trying
      to do the final link.
      
      (Theoretically we can cross a mountpoint even with fd-relative
       though this is a lot less likely)
      5ee2f1be
  21. Sep 13, 2017
    • Colin Walters's avatar
      tests: Add macro for auto-error checking · c2bcca04
      Colin Walters authored
      Having our tests forced into a `goto out` style is seriously annoying
      since we can't write tests like we write production code.  Add
      a macro that checks for the error being NULL.
      
      This doesn't fully solve the problem since the test functions are
      still forced into `void` returns; at some point I may extend
      GLib to have `g_test_add_err_func()`.
      c2bcca04
  22. Sep 12, 2017
    • Colin Walters's avatar
      fdio: Use O_TMPFILE + rename-overwrite for regfile copies · 673f48f6
      Colin Walters authored
      I was working on rpm-ostree unified core, and hit the fact that
      `glnx_file_copy_at()` had the same bug with `fsetxattr()` and files whose mode
      is <= `0400` (e.g. `000` in the case of `/etc/shadow`) that libostree did a
      while ago.  Basically, Linux currently allows `write()` on non-writable open files
      but not `fsetxattr()`.  This situation is masked for privileged (i.e.
      `CAP_DAC_OVERRIDE`) code.
      
      Looking at this, I think it's cleaner to convert to `O_TMPFILE` here,
      since that code already handles setting the tmpfile to mode `0600`.  Now,
      this *is* a behavior change in the corner case of existing files which
      are symbolic links.  Previously we'd do an `open(O_TRUNC)` which would follow
      the link.
      
      But in the big picture, I think the use cases for `open(O_TRUNC)` are really
      rare - I audited all callers of this in ostree/rpm-ostree/flatpak, and all of
      them will be fine with this behavior change. For example, the ostree `/etc`
      merge code already explicitly unlinks the target beforehand. Other cases like
      supporting `repo/pubring.gpg` in an ostree repo being a symlink...eh, just no.
      
      Making this change allows us to convert to new style, and brings all of the
      general benefits of using `O_TMPFILE` too.
      673f48f6
    • Colin Walters's avatar
      fdio: Support taking ownership of tmpfile fd · 9d995a36
      Colin Walters authored
      While reading a strace I noticed a double close in the tests; this was because
      we were missing an assignment to `-1` in the tests. However, let's make
      supporting this clearer by explicitly supporting the fd being `-1` while still
      setting the `initialized` variable to `FALSE`. We also add the `EBADF` assertion
      checking.
      9d995a36
  23. Sep 07, 2017
    • Colin Walters's avatar
      fdio: Add glnx_fstatat_allow_noent() · 627d4e2f
      Colin Walters authored
      This is a very common pattern in both ostree/rpm-ostree. Make a better API for
      this. I thought a lot about simply zeroing out `struct stat` but that feels
      dangerous; none of the values have seem obviously `cannot be zero`.
      627d4e2f
  24. Aug 25, 2017
  25. Aug 18, 2017
    • Colin Walters's avatar
      dirfd: New tmpdir API · 7100ebbc
      Colin Walters authored
      Basically all of the ostree/rpm-ostree callers want to both create and open, so
      let's merge `glnx_mkdtempat()` and `glnx_mkdtempat_open()`.
      
      Second, all of them want to do `glnx_shutil_rm_rf_at()` on cleanup, so we do the
      same thing we did with `GLnxTmpfile` and create `GLnxTmpDir` that has a cleanup
      attribute.
      
      The cleanup this results in for rpm-ostree is pretty substantial.
      7100ebbc
  26. Jul 24, 2017
  27. Jul 19, 2017
    • Colin Walters's avatar
      fdio: Introduce glnx_openat_read() · 268ae488
      Colin Walters authored
      This is kind of long overdue. Reasons are the same as the other wrappers. I
      debated adding `O_NOFOLLOW` support but the use cases for that are pretty
      obscure, callers who want that can just use the syscall directly for now.
      268ae488
  28. Jul 17, 2017
    • Colin Walters's avatar
      errors: Add GLNX_AUTO_PREFIX_ERROR · 607f1775
      Colin Walters authored
      In a lot of places in ostree, we end up prefixing errors in the *caller*.
      Often we only have 1-2 callers, and doing the error prefixing isn't
      too duplicative.  But there are definitely cases where it's cleaner
      to do the prefixing in the callee.  We have functions that aren't
      ported to new style for this reason (they still do the prefixing
      in `out:`).
      
      Introduce a cleanup-oriented version of error prefixing so we can port those
      functions too.
      607f1775
    • Colin Walters's avatar
      fdio: Add cleanup+flush API for FILE* · e30a773f
      Colin Walters authored
      Mostly in ostree/rpm-ostree, we work in either raw `int fd`, or
      `G{Input,Output}Stream`.  One exception is the rpm-ostree `/etc/passwd`
      handling, which uses `FILE*` since that's what glibc exposes.
      
      And in general, there are use cases for `FILE*`; the raw `GUnixOutputStream` for
      example isn't buffered, and doing so via e.g. `GBufferedOutputStream` means
      allocating *two* GObjects and even worse going through multiple vfuncs for every
      write.
      
      `FILE*` is used heavily in systemd, and provides buffering. It is a bit cheaper
      than gobjects, but has its own trap; by default every operation locks a mutex.
      For more information on that, see `unlocked_stdio(3)`. However, callers can
      avoid that by using e.g. `fwrite_unlocked`, which I plan to do for most users of
      `FILE*` that aren't writing to one of the standard streams like `stdout` etc.
      e30a773f
Loading