Commit Graph

119 Commits

Author SHA1 Message Date
Edward Thomson
53c14952ba docs: properly parse enum values
For enum values that are constructed, not literal integers, we need to
parse the inner / implicit expression. For example:

```
GIT_DIFF_REVERSE = (1u << 0)
```
2024-12-23 17:22:43 +00:00
Edward Thomson
0f1cb81a0c Documentation: clean up old documentation
Clean up the outdated documentation folder before re-generating it in
place. This accomodates a deleted API.
2024-12-10 23:22:35 +00:00
Edward Thomson
8ae0a22bf9 Documentation: don't resort versions
Array.sort() mutates the array _and_ returns it; don't mutate the
version array.
2024-12-09 17:02:37 +00:00
Edward Thomson
5efc00612c Generate search page in documentation generation 2024-12-09 12:39:21 +00:00
Edward Thomson
6297b6195c Add search capabilities to docs
Include "minisearch" which is a straightforward client-side search tool;
and a script to generate the search index for minisearch for each
version of libgit2.
2024-12-09 12:39:21 +00:00
Edward Thomson
1da67ef096 Allow documentation (re)generation in CI build
Provide a mechanism to allow the documentation to be force rebuilt.
2024-12-09 12:39:21 +00:00
Edward Thomson
0bd5e479b2 Introduce a "validate only" mode for docs generation
The API documentation generation is useful (in `--strict` mode) to
determine whether all our APIs have sufficient documentation. Add a
`--validate-only` mode that will run the validation without emitting the
API JSON. This is useful for ensuring that the documentation is
complete.
2024-11-26 21:22:10 +00:00
Edward Thomson
89cc5ef8e8 Include documentation generator
libgit2 has a new documentation generator that generates API schema from
our headers, then produces reference documentation that is included into
the website directly.
2024-11-25 23:00:07 +00:00
Edward Thomson
fb1797de63 Merge remote-tracking branch 'origin/main' into libgit2-httpparser 2024-04-23 00:09:50 +01:00
Edward Thomson
64808a9a8e ci: fixes for fedora
Use fedora's valgrind instead of trying to build our own; omit false
positive leaks in getaddrinfo;
2024-04-23 00:07:48 +01:00
Edward Thomson
4504f2c5cf valgrind: suppress OpenSSL warnings 2024-03-18 10:33:44 +00:00
Edward Thomson
a283c1bd1b ci: valgrind shouldn't report on exited children
Now that we (may) exec a child process to do ssh, we don't want valgrind
reporting on that. Suppress children in valgrind runs.
2023-08-30 20:46:23 +01:00
Edward Thomson
c9b80c2573 valgrind: suppress leaks in dlopen and newer libraries
dlopen sets up some thread-local state that isn't cleaned up by
`dlclose`.  Additionally, now that we're linking against different
versions of libssh2 and OpenSSL, we're seeing different leak signatures.
2021-08-24 16:23:46 -04:00
lhchavez
322c15ee85 Make the pack and mwindow implementations data-race-free
This change fixes a packfile heap corruption that can happen when
interacting with multiple packfiles concurrently across multiple
threads. This is exacerbated by setting a lower mwindow open file limit.

This change:

* Renames most of the internal methods in pack.c to clearly indicate
  that they expect to be called with a certain lock held, making
  reasoning about the state of locks a bit easier.
* Splits the `git_pack_file` lock in two: the one in `git_pack_file`
  only protects the `index_map`. The protection to `git_mwindow_file` is
  now in that struct.
* Explicitly checks for freshness of the `git_pack_file` in
  `git_packfile_unpack_header`: this allows the mwindow implementation
  to close files whenever there is enough cache pressure, and
  `git_packfile_unpack_header` will reopen the packfile if needed.
* After a call to `p_munmap()`, the `data` and `len` fields are poisoned
  with `NULL` to make use-after-frees more evident and crash rather than
  being open to the possibility of heap corruption.
* Adds a test case to prevent this from regressing in the future.

Fixes: #5591
2020-11-28 19:40:56 -08:00
lhchavez
4ae41f9c63 Make the odb race-free
This change adds all the necessary locking to the odb to avoid races in
the backends.

Part of: #5592
2020-11-28 15:12:14 -08:00
lhchavez
896b1db493 Add a ThreadSanitizer build
This change adds a ThreadSanitizer CI build rule. It's informative for
now because there are still known places where there are races.

Part of: #5592
2020-08-03 09:37:32 -07:00
Edward Thomson
11a62973d8 Merge pull request #5569 from lhchavez/ci-sanitizers
Add CI support for Memory and UndefinedBehavior Sanitizers
2020-08-03 10:01:26 +01:00
Patrick Steinhardt
19eb1e4bb7 cmake: specify project version
We currently do not set up a project version within CMake, meaning that
it can't be use by other projects including libgit2 as a sub-project and
also not by other tools like IDEs.

This commit changes this to always set up a project version, but instead
of extracting it from the "version.h" header we now set it up directly.
This is mostly to avoid mis-use of the previous `LIBGIT2_VERSION`
variables, as we should now always use the `libgit2_VERSION` ones that
are set up by CMake if one provides the "VERSION" keyword to the
`project()` call. While this is one more moving target we need to adjust
on releases, this commit also adjusts our release script to verify that
the project version was incremented as expected.
2020-07-12 14:45:47 +02:00
lhchavez
6a917c0439 Add CI support for Memory and UndefinedBehavior Sanitizers
This change adds two new build targets: MSan and UBSan. This is because
even though OSS-Fuzz is great and adds a lot of coverage, it only does
that for the fuzz targets, so the rest of the codebase is not
necessarily run with the Sanitizers ever :( So this change makes sure
that MSan/UBSan warnings don't make it into the codebase.

As part of this change, the Ubuntu focal container is introduced. It
builds mbedTLS and libssh2 as debug libraries into /usr/local and as
MSan-enabled libraries into /usr/local/msan. This latter part is needed
because MSan requires the binary and all its dependent libraries to be
built with MSan support so that memory allocations and deallocations are
tracked correctly to avoid false positives.
2020-07-09 15:13:34 -07:00
Edward Thomson
b79f7d386c release script: fix typo 2020-06-04 09:49:38 +01:00
Suhaib Mujahid
f1c1458cb1 feat: Check the version in package.json 2020-05-12 10:55:14 -04:00
Patrick Steinhardt
2ae45bc318 scripts: add script to create releases
The current release process is not documented in any way. As a result,
it's not obvious how releases should be done at all, like e.g. which
locations need adjusting.

To fix this, let's introduce a new script that shall from now on be used
to do all releases. As input it gets the tree that shall be released,
the repository in which to do the release, credentials to
authenticate against GitHub and the new version. E.g. executing the
following will create a new release v0.32:

    $ ./script/release.py 0.32.0 --user pks-t --password ****

While the password may currently be your usual GitLab password, it's
recommended to use a personal access token intead.

The script will then perform the following steps:

    1. Verify that "include/git2/version.h" matches the new version.

    2. Verify that "docs/changelog.md" has a section for that new
       version.

    3. Extract the changelog entries for the current release from
       "docs/changelog.md".

    4. Generate two archives in "tar.gz" and "zip" format via "git
       archive" from the tree passed by the user. If no tree was passed,
       we will use "HEAD".

    5. Create the GitHub release using the extracted changelog entries
       as well as tag and name information derived from the version
       passed by the used.

    6. Upload both code archives to that release.

This should cover all steps required for a new release and thus ensures
that nothing is missing that shouldn't be.
2020-02-07 15:06:24 +01:00
Edward Thomson
2ad3eb3e8e valgrind: add suppressions for undefined use
valgrind will warn that OpenSSL will use undefined data in connect/read
when talking to certain other TLS stacks.  Thankfully, this only seems
to occur when gcc is the compiler, so hopefully valgrind is just
misunderstanding an optimization.  Regardless, suppress this warning.
2019-11-24 17:29:38 +11:00
Edward Thomson
6df3ec4a52 valgrind: suppress libssh2_rsa_sha1_sign leaks 2019-11-24 16:49:35 +11:00
Edward Thomson
7adc32d525 valgrind: suppress kexinit leaks 2019-11-24 16:49:35 +11:00
Edward Thomson
5dc1be8d54 valgrind: suppress uninitialized reads in libcrypto
libcrypto will read uninitialized memory as entropy.  Suppress warnings
from this behavior.
2019-11-23 11:28:02 +11:00
Patrick Steinhardt
56d5b4432b valgrind: suppress memory leaks in libssh2_session_handshake
On Ubuntu, the combination of libgcrypt and libssh2 is quite old and
known to contain memory leaks. We thus have several functions listed in
our suppressions file that are known to leak. Due to a recent update of
libssh2 or libgcrypt, there now are new memory leaks caused by
libssh2_session_handshake and libssh2_init that cause the CI to fail.

Add a new suppression to fix the issue.
2019-09-21 18:21:47 +02:00
Patrick Steinhardt
d827b11b67 tests: execute leak checker via CTest directly
Right now, we have an awful hack in our test CI setup that extracts the
test command from CTest's output and then prepends the leak checker.
This is dependent on non-machine-parseable output from CMake and also
breaks on various ocassions, like for example when we have spaces in the
current path or when the path contains backslashes. Both conditions may
easily be triggered on Win32 systems, and in fact they do break our
Azure Pipelines builds.

Remove the awful hack in favour of a new CMake build option
"USE_LEAK_CHECKER". If specifying e.g. "-DUSE_LEAK_CHECKER=valgrind",
then we will set up all tests to be run under valgrind. Like this, we
can again simply execute ctest without needing to rely on evil sourcery.
2019-07-20 19:10:10 +02:00
Edward Thomson
00c66dfd3b errors: update static analysis tools for giterr
Update GITERR and giterr usages in the static code analysis tools to use
the new names.
2019-01-22 22:30:37 +00:00
Etienne Samson
a74f4fb9d2 coverity: attempt to model clar's assertions
Coverity considers that anything that looks like assert() behaves like
it (ie. side-effects would be skipped on a NDEBUG build). As we have a
bunch of those in the test suite (128), this would ensure Coverity isn't
confused.
2019-01-04 14:04:48 +01:00
Edward Thomson
24d175621b ci: remove unused old ci scripts 2018-07-28 23:54:46 +01:00
Edward Thomson
24b8dd8275 ci: move travis to the new scripts 2018-07-28 23:54:46 +01:00
Edward Thomson
465f8b5163 ci: move appveyor to new scripts 2018-07-27 16:54:35 +01:00
Edward Thomson
b00672b9e4 ci: enable leak checking on osx 2018-07-26 15:34:53 +01:00
Edward Thomson
ce798b256b tests: simplify cmake test configuration
Simplify the names for the tests, removing the unnecessary
"libgit2-clar" prefix.  Make "all" the new default test run, and include
the online tests by default (since HTTPS should always be enabled).

For the CI tests, create an offline-only test, then the various online
tests.
2018-07-26 14:07:00 +01:00
Etienne Samson
61eaaadf7f travis: enable -Werror in the script instead of using the matrix 2018-06-06 13:15:50 +02:00
Etienne Samson
149790b96e scripts: remove extraneous semicolons 2018-06-06 13:15:50 +02:00
Etienne Samson
4c969618f6 scripts: use leaks on macOS 2018-06-06 13:15:50 +02:00
Etienne Samson
0fb8c1d09c valgrind: bump num-callers to 50 for fuller stack traces 2018-06-06 13:15:50 +02:00
Etienne Samson
1f4ada2a42 travis: let cmake perform the build & install step
The goal is to let cmake manage the parallelism
2018-06-06 13:15:50 +02:00
Etienne Samson
573c408921 valgrind: skip buf::oom test 2018-06-06 13:15:50 +02:00
Etienne Samson
74b0a43207 travis: split valgrind check in its own script 2018-06-06 13:15:50 +02:00
Etienne Samson
2f4e7cb0e8 travis: split testing from building 2018-06-06 13:15:50 +02:00
Edward Thomson
86353a7260 Merge pull request #4173 from tiennou/mbedtls
mbedTLS support
2018-04-22 14:57:02 +01:00
Edward Thomson
d906a8796c Merge pull request #4476 from pks-t/pks/backport-script
scripts: add backporting script
2018-04-17 23:39:54 +01:00
Etienne Samson
cb2da47e56 travis: pass -fPIC when configuring mbedtls 2018-04-11 21:02:44 +02:00
Etienne Samson
10aff3d523 travis: just grab what we need from mbedtls 2018-04-11 21:02:43 +02:00
Etienne Samson
262dfcf0bf mbedtls: enable Travis CI tests 2018-04-11 21:02:43 +02:00
Patrick Steinhardt
0b3d859257 scripts: add backporting script
This adds a simple script for backporting pull requests to older
branches. It accepts as parameters a list of pull request numbers which
whose commits are to be cherry-picked. The identification of PRs
currently happens by using the commit message of the merge of the PR,
which should conform to the message "Merge pull request #<PR>".

While the heuristic works in practice, we could instead also use the
direct references from GitHub via "pull/#<PR>/head". This requires the
user to have all these references fetched, though, so we can just use
the current heuristic until we experience any issues with that.
2018-01-12 11:10:00 +00:00
Patrick Steinhardt
5874e151d7 tests: create new test target for all SSH-based tests
Some tests shall be run against our own SSH server we spin up in Travis.
As those need to be run separate from our previous tests which run
against git-daemon, we have to do this in a separate step. Instead of
bundling all that knowledge in the CI script, move it into the test
build instructions by creating a new test target.
2018-01-03 11:50:39 +00:00