1. 02 Jun, 2020 3 commits
    • clar: remove files internally instead of /bin/rm · ee9e9163
      Similar to how clar has used `/bin/cp` to copy files, it's used
      `/bin/rm` to remove them.  This has similar deficiencies; meaning that
      leaks is noisy and it's slow.  Move it to an internal function.
      Edward Thomson committed
    • clar: copy files internally instead of /bin/cp · 8df4f519
      clar has historically shelled out to `/bin/cp` to copy test fixtures
      into a sandbox.  This has two deficiencies:
      
      1. It's slower than simply opening the source and destination and
         copying them in a read/write loop.  On my Mac, the `/bin/cp` based
         approach takes ~2:40 for a full test pass.  Using a read/write loop
         to copy the files ourselves takes ~1:50.
      
      2. It's noisy.  Since the leak detector follows fork/exec, we'll end up
         running the leak detector on `/bin/cp`.  This would be fine, except
         that the leak detector spams the console on startup and shutdown, so
         it adds a _lot_ of additional information to the test runs that is
         useless.  By not forking and using this internal system, we see much
         less output.
      Edward Thomson committed
  2. 01 Jun, 2020 17 commits
  3. 26 May, 2020 1 commit
  4. 25 May, 2020 1 commit
  5. 23 May, 2020 6 commits
  6. 16 May, 2020 2 commits
    • checkout: fix file being treated as unmodified due to racy index · 3f201f75
      When trying to determine whether a file changed, we try to avoid heavy
      operations by fist taking a look at the index, seeing whether the index
      entry is modified already. This doesn't seem to cut it, though, as we
      currently have the racy checkout::index::can_disable_pathspec_match test
      case: sometimes the files get restored to their original contents,
      sometimes they aren't.
      
      The issue is caused by a racy index [1]: in case we modify a file, add
      it to the index and then modify it again in-place without changing its
      file, then we may end up with a modified file that has the same stat(3P)
      info as we've currently got it in its corresponding index entry. The
      mitigation for this is to treat files with the same mtime as the index
      are treated as racily modified. We already have this logic in place for
      the index, but not when doing a checkout.
      
      Fix the issue by only consulting the index entry in case it has an older
      mtime as the index. Previously, the following script reliably had at
      least 20 failures, while now there is no failure to be observed anymore:
      
      ```bash
      j=0
      for i in $(seq 100)
      do
      	if ! ./libgit2_clar -scheckout::index::can_disable_pathspec_match >/dev/null
      	then
      		j=$(($j + 1))
      	fi
      done
      echo "Failures: $j"
      ```
      
      [1]: https://git-scm.com/docs/racy-git
      Patrick Steinhardt committed
    • tests: checkout: fix stylistic issues and static variable · 915f8860
      The test case checkout::index::can_disable_pathspec_match has some
      shortcomings when it comes to coding style, which didn't fit our own
      coding style. Furthermore, it had an unnecessary static local variable.
      
      The test has been refactored to address these issues.
      Patrick Steinhardt committed
  7. 15 May, 2020 2 commits
    • cmake: Sort source files for reproducible builds · b85eefb4
      We currently use `FILE(GLOB ...)` in most places to find source and
      header files. This is problematic in that the order of files returned
      depends on the operating system's directory iteration order and may thus
      not be deterministic. As a result, we link object files in unspecified
      order, which may cause the linker to emit different code across runs.
      
      Fix this issue by sorting all code used as input to the libgit2 library
      to improve the reliability of reproducible builds.
      Patrick Steinhardt committed
    • streams: openssl: fix memleak due to us not free'ing certs · b43a9e66
      When creating a `git_cert` from the OpenSSL X509 certificate of a given
      stream, we do not call `X509_free()` on the certificate, leading to a
      memory leak as soon as the certificate is requested e.g. by the
      certificate check callback.
      
      Fix the issue by properly calling `X509_free()`.
      Patrick Steinhardt committed
  8. 12 May, 2020 7 commits
  9. 11 May, 2020 1 commit