-
Notifications
You must be signed in to change notification settings - Fork 25.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
meson: backfill a couple of missing features #1870
base: master
Are you sure you want to change the base?
Conversation
…build * ps/weak-sha1-for-tail-sum-fix: ci: exercise unsafe OpenSSL backend builtin/fast-import: fix segfault with unsafe SHA1 backend bulk-checkin: fix segfault with unsafe SHA1 backend
The 'CommonCrypto' backend can be specified as HTTPS and SHA1 backends, but the value that one needs to use is inconsistent across those two build options. Unify it to 'CommonCrypto'. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
We've got a couple of repeated calls to `get_option()` for the SHA1 and SHA256 backend options. While not an issue, it makes the code needlessly verbose. Fix this by consistently using a local variable. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
The Security framework is required when we use CommonCrypto either as HTTPS or SHA1 backend, but we only require it in case it is set up as HTTPS backend. Fix this. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
The conditions used to figure out whteher the Security framework or OpenSSL library is required are a bit convoluted because they can be pulled in via the HTTPS, SHA1 or SHA256 backends. Refactor them to be easier to read. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Most of our Meson build options end with a trailing dot, but those for our SHA1 and SHA256 backends don't. Add it. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
In 06c92da (Makefile: allow specifying a SHA-1 for non-cryptographic uses, 2024-09-26), we have introduced a cryptographically-insecure backend for SHA1 that can optionally be used in some contexts where the processed data is not security relevant. This effort was in-flight with the effort to introduce Meson, so we don't have an equivalent here. Wire up a new build option that lets users pick an unsafe SHA1 backend. Note that for simplicity's sake we have to drop the error condition around an unhandled SHA1 backend. This should be fine though given that Meson verifies the value for combo-options for us. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
There are a couple of backends from which the user can choose for HTTPS, SHA1, its unsafe variant as well as SHA256. Provide a summary of the configured values to make these more discoverable. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
There are merge commits in this Pull Request:
Please rebase the branch and force-push. |
cfe4eb8
to
e6d4ba6
Compare
There are merge commits in this Pull Request:
Please rebase the branch and force-push. |
e6d4ba6
to
ad32eb8
Compare
There are merge commits in this Pull Request:
Please rebase the branch and force-push. |
ad32eb8
to
1e4a042
Compare
There are merge commits in this Pull Request:
Please rebase the branch and force-push. |
1e4a042
to
aec2b40
Compare
There are merge commits in this Pull Request:
Please rebase the branch and force-push. |
1 similar comment
There are merge commits in this Pull Request:
Please rebase the branch and force-push. |
12106d7
to
0d78c32
Compare
There are merge commits in this Pull Request:
Please rebase the branch and force-push. |
4 similar comments
There are merge commits in this Pull Request:
Please rebase the branch and force-push. |
There are merge commits in this Pull Request:
Please rebase the branch and force-push. |
There are merge commits in this Pull Request:
Please rebase the branch and force-push. |
There are merge commits in this Pull Request:
Please rebase the branch and force-push. |
235a196
to
7a4f1fc
Compare
There are issues in commit 2f6944e: |
7a4f1fc
to
e4711a2
Compare
There are issues in commit 2f6944e: |
Hi, this small patch series backfills in a couple of missing features into Meson. It also improves test coverage of our Meson-based CI jobs so that we compile with Meson with Visual Studio and compile fuzzers. CI runs for GitLab and GitHub can be found at [1] and [2], respectively. The series is built on top of fbe8d30 (Git 2.48, 2025-01-10) with ps/meson-weak-sha1-build at 6a0ee54 (meson: provide a summary of configured backends, 2024-12-30) merged into it. Changes in v2: - Consistently use `meson.has_header_symbol()` to fix warnings for features not yet available in Meson 0.61, which is our minimum required version. - Add another patch that makes use use `--fatal-meson-warnings` so that such warnings will cause the build to fail. - Fix a bug that made GIT-VERSION-GEN always return tags as version. - Adapt the approach we use to populate the project and distribution tarball versions. - Link to v1: https://lore.kernel.org/r/20250113-b4-pks-meson-additions-v1-0-97f6a93f691d@pks.im Thanks! Patrick [1]: https://gitlab.com/gitlab-org/git/-/merge_requests/280 [2]: git#1870 To: git@vger.kernel.org Cc: Evan Martin <evan.martin@gmail.com> Cc: Eli Schwartz <eschwartz@gentoo.org> Cc: Junio C Hamano <gitster@pobox.com> Cc: M Hickford <mirth.hickford@gmail.com> --- b4-submit-tracking --- # This section is used internally by b4 prep for tracking purposes. { "series": { "revision": 2, "change-id": "20250107-b4-pks-meson-additions-055c16b3052b", "prefixes": [], "history": { "v1": [ "20250113-b4-pks-meson-additions-v1-0-97f6a93f691d@pks.im" ] } } }
Hi, this small patch series backfills in a couple of missing features into Meson. It also improves test coverage of our Meson-based CI jobs so that we compile with Meson with Visual Studio and compile fuzzers. CI runs for GitLab and GitHub can be found at [1] and [2], respectively. The series is built on top of fbe8d30 (Git 2.48, 2025-01-10) with ps/meson-weak-sha1-build at 6a0ee54 (meson: provide a summary of configured backends, 2024-12-30) merged into it. Thanks! Patrick [1]: https://gitlab.com/gitlab-org/git/-/merge_requests/280 [2]: git#1870 To: git@vger.kernel.org Cc: Evan Martin <evan.martin@gmail.com> --- b4-submit-tracking --- # This section is used internally by b4 prep for tracking purposes. { "series": { "revision": 1, "change-id": "20250107-b4-pks-meson-additions-055c16b3052b", "prefixes": [] } }
e4711a2
to
f30f91a
Compare
There are merge commits in this Pull Request:
Please rebase the branch and force-push. |
Hi, this small patch series backfills in a couple of missing features into Meson. It also improves test coverage of our Meson-based CI jobs so that we compile with Meson with Visual Studio and compile fuzzers. CI runs for GitLab and GitHub can be found at [1] and [2], respectively. The series is built on top of fbe8d30 (Git 2.48, 2025-01-10) with ps/meson-weak-sha1-build at 6a0ee54 (meson: provide a summary of configured backends, 2024-12-30) merged into it. Changes in v2: - Consistently use `meson.has_header_symbol()` to fix warnings for features not yet available in Meson 0.61, which is our minimum required version. - Add another patch that makes use use `--fatal-meson-warnings` so that such warnings will cause the build to fail. - Link to v1: https://lore.kernel.org/r/20250113-b4-pks-meson-additions-v1-0-97f6a93f691d@pks.im Thanks! Patrick [1]: https://gitlab.com/gitlab-org/git/-/merge_requests/280 [2]: git#1870 To: git@vger.kernel.org Cc: Evan Martin <evan.martin@gmail.com> Cc: Eli Schwartz <eschwartz@gentoo.org> --- b4-submit-tracking --- # This section is used internally by b4 prep for tracking purposes. { "series": { "revision": 2, "change-id": "20250107-b4-pks-meson-additions-055c16b3052b", "prefixes": [], "history": { "v1": [ "20250113-b4-pks-meson-additions-v1-0-97f6a93f691d@pks.im" ] } } }
f30f91a
to
21e6baa
Compare
There are merge commits in this Pull Request:
Please rebase the branch and force-push. |
21e6baa
to
cac07ac
Compare
There are merge commits in this Pull Request:
Please rebase the branch and force-push. |
cac07ac
to
1bcfdc6
Compare
There are merge commits in this Pull Request:
Please rebase the branch and force-push. |
1bcfdc6
to
ac7f5f0
Compare
There are merge commits in this Pull Request:
Please rebase the branch and force-push. |
ac7f5f0
to
69d3a70
Compare
There are merge commits in this Pull Request:
Please rebase the branch and force-push. |
The GIT-VERSION-GEN script computes the version that Git is being built from. When building from a commit with an unclean worktree it knows to append "-dirty" to that version to indicate that there were custom changes applied and that it isn't the exact same as that commit. The dirtiness check is done manually via git-diff-index(1), which is somewhat puzzling though: we already use git-describe(1) to compute the version, which also knows to compute dirtiness via the "--dirty" flag. But digging back in history explains why: the "-dirty" suffix was added in 31e0b2c (GIT 1.5.4.3, 2008-02-23), and git-describe(1) didn't yet have support for "--dirty" back then. Refactor the script to use git-describe(1). Despite being simpler, it also results in a small speedup: Benchmark 1: git describe --dirty --match "v[0-9]*" Time (mean ± σ): 12.5 ms ± 0.3 ms [User: 6.3 ms, System: 8.8 ms] Range (min … max): 12.0 ms … 13.5 ms 200 runs Benchmark 2: git describe --match "v[0-9]*" HEAD && git update-index -q --refresh && git diff-index --name-only HEAD -- Time (mean ± σ): 17.9 ms ± 1.1 ms [User: 8.8 ms, System: 14.4 ms] Range (min … max): 17.0 ms … 30.6 ms 148 runs Summary git describe --dirty --match "v[0-9]*" ran 1.43 ± 0.09 times faster than git describe --match "v[0-9]*" && git update-index -q --refresh && git diff-index --name-only HEAD -- While the speedup doesn't really matter on Unix-based systems, where filesystem operations are typically fast, they do matter on Windows where the commands take a couple hundred milliseconds. A quick and dirty check on that system shows a speedup from ~800ms to ~400ms. Signed-off-by: Patrick Steinhardt <ps@pks.im>
The GIT-VERSION-GEN script requires an input file containing formatting directives to be replaced as well as an output file that will get overwritten in case the file contents have changed. When computing the project version for Meson we don't want to have either though: - We only want to compute the version without anything else, but don't have an input file that would match that exact format. While we could of course introduce a new file just for that usecase, it feels suboptimal to add another file every time we want to have a slightly different format for versioned data. - The computed version needs to be read from stdout so that Meson can wire it up for the project. Extend the script to handle both usecases by recognizing `--format=` as alternative to providing an input path and by writing to stdout in case no output file was given. Signed-off-by: Patrick Steinhardt <ps@pks.im>
The Git version for Meson is currently wired up manually. It can thus grow (and alread has grown) stale quite easily, as having multiple sources of truth is never a good idea. This issue is mostly of cosmetic nature as we don't use the project version anywhere, and instead use the GIT-VERSION-GEN script to propagate the correct version into our build. But it is somewhat puzzling when `meson setup` announces to build an old Git release. There are a couple of alternatives for how to solve this: - We can keep the version undefined, but this makes Meson output "undefined" for the version, as well. - We can use GIT-VERSION-GEN to generate the version for us. At the point of configuring the project we haven't yet figured out host details though, and thus we didn't yet set up the shell environment. While not an issue for Unix-based systems, this would be an issue in Windows, where the shell typically gets provided via Git for Windows and thus requires some special setup. - We can pull the default version out of GIT-VERSION-GEN and move it into its own file. This likely requires some adjustments for scripts that bump the version, but allows Meson to read the version from that file trivially. Pick the second option and use GIT-VERSION-GEN as it gives us the most accurate version. In order to fix the bootstrapping issue on Windows systems we simply set the version to 'unknown' in case no shell was found. As the version is only of cosmetic value this isn't really much of an issue. Signed-off-by: Patrick Steinhardt <ps@pks.im>
We generate a couple of headers from our documentation. These headers are added to the libgit sources, but two of them aren't used by the library, but instead by our builtins. This can cause parallel builds to fail because the builtin object may be compiled before the header was generated. Fix the issue by adding both "config-list.h" and "hook-list.h" to the list of builtin sources. While "command-list.h" is generated similarly, it is used by "help.c" and thus part of the libgit sources indeed. Reported-by: Evan Martin <evan.martin@gmail.com> Signed-off-by: Patrick Steinhardt <ps@pks.im>
The Meson build system is able to wire up development environments. The intent is to make build artifacts of the project available. This is typically used to export e.g. paths to linkable libraries, which isn't all that interesting in our context given that we don't have an official library interface. But what we can use this mechanism for is to expose the built Git executables as well as the build directory. This allows users to play around with the built Git version in the devenv, and allows them to execute our test scripts directly with the built distribution. Wire up this feature, which can then be used via `meson devenv` in the build directory. Signed-off-by: Patrick Steinhardt <ps@pks.im>
Meson knows to generate distribution archives via `meson dist`. In addition to generating the archive itself, this target also knows to compile and execute tests from that archive, which helps to ensure that the result is an adequate drop-in replacement for the versioned project. While this already works as-is, one omission is that we don't propagate the commit that this is built from into the resulting archive. This can be fixed though by adding a distribution script that propagates the version into the "version" file, which GIT-VERSION-GEN knows to read if present. Use GIT-VERSION-GEN to populate that file. As the script is executed in the build directory, not in the directory where we generate the archive, we have adapt it to honor the "MESON_DIST_ROOT" environment variable. Signed-off-by: Patrick Steinhardt <ps@pks.im>
Meson does not yet know to build our fuzzers. Introduce a new build option "fuzzers" and wire up the fuzzers in case it is enabled. Adapt our CI jobs so that they build the fuzzers by default. Signed-off-by: Patrick Steinhardt <ps@pks.im>
The CSPRNG backend is not configurable in Meson and isn't quite discoverable, either. Make it configurable and add the actual backend used to the summary. Signed-off-by: Patrick Steinhardt <ps@pks.im>
The Visual Studio compiler defaults to C89 unless explicitly asked to use a different version of the C standard. We don't specify any C standard at all though in our Meson build, and consequently compiling Git fails: ...\git\git-compat-util.h(14): fatal error C1189: #error: "Required C99 support is in a test phase. Please see git-compat-util.h for more details." Fix the issue by specifying the project's C standard. Funny enough, specifying C99 does not work because apparently, `__STDC_VERSION__` is not getting defined in that version at all. Instead, we have to specify C11 as the project's C standard, which is also done in our CMake build instructions. We don't want to generally enforce C11 though, as our requiremets only state that a C99 compiler is required. In fact, we don't even require plain C99, but rather the GNU variant thereof. Meson allows us to handle this case rather easily by specifying "gnu99,c11", which will cause it to fall back to C11 in case GNU C99 is unsupported. This feature has only been introduced with Meson 1.3.0 though, and we support 0.61.0 and newer. In case we use such an oldish version though we fall back to requiring GNU99 unconditionally. This means that Windows essentially requires Meson 1.3.0 and newer when using Visual Studio, but I doubt that this is ever going to be a real problem. Tested-by: M Hickford <mirth.hickford@gmail.com> Signed-off-by: Patrick Steinhardt <ps@pks.im>
Meson prints warnings in several cases, like for example when using a feature supported by the current version of Meson, but not yet supported by the minimum required version as declared by the project. These warnings will not cause the setup to fail by default, which makes it quite easy to miss them. Improve this by passing `--fatal-meson-warnings` to `meson setup` so that our CI jobs will fail on warnings. Signed-off-by: Patrick Steinhardt <ps@pks.im>
Add a new job to GitHub Actions and GitLab CI that builds and tests Meson-based builds with Visual Studio. A couple notes: - While the build job is mandatory, the test job is marked as "manual" on GitLab so that it doesn't run by default. We already have a bunch of Windows-based jobs, and the computational overhead that these cause is simply out of proportion to run the test suite twice. The same isn't true for GitHub as I could not find a way to make a subset of jobs manually triggered. - We disable Perl. This is because we pick up Perl from Git for Windows, which outputs different paths ("/c/" instead of "C:\") than what we expect in our tests. - We don't use the Git for Windows SDK. Instead, the build only depends on Visual Studio, Meson and Git for Windows. All the other dependencies like curl, pcre2 and zlib get pulled in and compiled automatically by Meson and thus do not have to be provided by the system. - We open-code "ci/run-test-slice.sh". This is because we only have direct access to PowerShell, so we manually implement the logic. There is an upstream pull request for the Meson build system [1] to implement test slicing in Meson directly. - We don't process test artifacts for failed CI jobs. This is done to keep down prerequisites to a minimum. All tests are passing. [1]: mesonbuild/meson#14092 Signed-off-by: Patrick Steinhardt <ps@pks.im>
69d3a70
to
8cec739
Compare
There are merge commits in this Pull Request:
Please rebase the branch and force-push. |
This is a test MR to verify changes to GitHub Actions.