Skip to content
Snippets Groups Projects
  1. Oct 25, 2016
    • Colin Walters's avatar
      fdio: Make GLnxFileCopyFlags actually flags · 7d2f577d
      Colin Walters authored
      I wanted to add a new one, and realized it was wrong.  Luckily,
      I think we were safe until now, since the set of bits for `(0, 1, 2)`
      is actually distinct.
      
      Although, hm, callers specifying `GLNX_FILE_COPY_OVERWRITE` may
      have not actually been getting that.
      7d2f577d
  2. Oct 05, 2016
  3. Aug 31, 2016
  4. Aug 30, 2016
  5. Aug 07, 2016
  6. Aug 05, 2016
  7. Aug 04, 2016
  8. Aug 03, 2016
  9. Jul 29, 2016
  10. Jul 22, 2016
  11. Jul 08, 2016
    • Colin Walters's avatar
      fdio: Add unlinkat() in error paths for tmpfiles · d2e588d9
      Colin Walters authored
      This is kind of an ABI change but it's for the better I think; on
      error we consistently clean up the temp file.
      
      This is obviously necessary without `O_TMPFILE`.  With it, we still
      need an error cleanup in the case where we're trying to replace an
      existing file.  I noticed this in ostree's `tests/test-refs.sh` which
      intentionally tries to rename a file over a directory path.
      d2e588d9
    • Colin Walters's avatar
      fdio: Use correct dfd with O_TMPFILE in rename case · 78ae7877
      Colin Walters authored
      While auditing this code to figure out why ostree's
      `tests/test-refs.sh` was failing, while the bug turned out to be
      different, I noticed that in the case where `dfd != target_dfd`, we
      failed to do the right `renameat()`.  (No code I'm aware of does this
      now).
      78ae7877
  12. Jul 01, 2016
    • Colin Walters's avatar
      fdio: Add open_tmpfile_linkable() and link_tmpfile_at() · 113c770d
      Colin Walters authored
      We had a bug previously where we failed to clean up a temporary file
      in an error path.  This is a classic case where the new `O_TMPFILE`
      API in Linux is nicer.
      
      To implement this, as usual we start with some original bits from
      systemd.  But in this case I ended up having to heavily modify it
      because systemd doesn't support "link into place and overwrite".  They
      don't actually use their tempfile code much at all in fact - as far as
      I can tell, just in the coredump code.
      
      Whereas in many apps, ostree included, a very common use case is
      atomically updating an existing file, which is
      `glnx_file_replace_contents_at()`, including subtleties like doing an
      `fdatasync()` if the file already existed.
      
      Implementing this then is slightly weird since we need to link() the
      file into place, then rename() after.
      
      It's still better though because if we e.g. hit `ENOSPC` halfway
      through, we'll clean up the file automatically.
      
      We still do keep the mode where we error out if the file exists.
      Finally, the ostree core though does have a more unusual case where we
      want to ignore EEXIST (allow concurrent object writers), so add
      support for that now.
      
      Note: One really confusing bug I had here was that `O_TMPFILE` ignores
      the provided mode, and this caused ostree to write refs that weren't
      world readable.
      
      Rework things so we always call `fchmod()`, but as a consequence we're
      no longer honoring umask in the default case.  I doubt anyone will
      care, and if they do we should probably fix ostree to consistently use
      a mode inherited from the repo or something.
      113c770d
  13. Jun 28, 2016
  14. Jun 16, 2016
    • Yu Qi Zhang's avatar
      fdio: Delete .tmp file on failure · a6d08657
      Yu Qi Zhang authored
      We noticed the temp files being left over in ostree when (mistakenly)
      trying to replace the contents of a subpath that wasn't a directory.
      
      In the future we should look at the systemd code using `O_TMPFILE`
      here.
      a6d08657
  15. May 31, 2016
  16. May 30, 2016
    • Colin Walters's avatar
      Introduce glnx_gen_temp_name() · 4919f6ee
      Colin Walters authored
      We have multiple copies growing again of this code.  glibc has this
      API internally and uses it in multiple places, let's do the same.
      
      Closes: #14
      4919f6ee
  17. May 10, 2016
  18. May 03, 2016
  19. May 02, 2016
  20. May 01, 2016
  21. Mar 10, 2016
  22. Feb 08, 2016
  23. Jan 26, 2016
  24. Jan 25, 2016
  25. Jan 24, 2016
  26. Jan 22, 2016
  27. Jan 11, 2016
    • Colin Walters's avatar
      fdio: Export loop_write · 3c470803
      Colin Walters authored
      I plan to use this in rpm-ostree.  Sad how many times this gets
      reinvented.  Should probably stick a copy in `glib-unix.h` or so.
      3c470803
  28. Jan 03, 2016
    • Colin Walters's avatar
      dirfd: Add a public API to ensure a filled dtype · 91e06069
      Colin Walters authored
      It's quite common to iterate over a directory recursively, only caring
      about the file type, but not other bits returned by `stat()`.
      
      Good file systems fill in `dt_type`, but not all do.  This function
      papers over that in userspace conveniently.
      91e06069
  29. Dec 17, 2015
  30. Dec 11, 2015
  31. Dec 02, 2015
  32. Dec 01, 2015
  33. Nov 23, 2015
  34. Nov 06, 2015
Loading