4772 Commits

Author SHA1 Message Date
Azat Khuzhin
bcefdbc67a
Merge pull request #1418 from fanquake/use_fortify_source_3
build: use FORTIFY_SOURCE=3 in hardening option
2023-02-14 09:56:03 +01:00
fanquake
e89ddd405b
build: use FORTIFY_SOURCE=3 in autotools build 2023-02-13 16:06:29 +00:00
fanquake
38cd76f09c
build: use FORTIFY_SOURCE=3 in CMake build 2023-02-13 16:05:58 +00:00
Azat Khuzhin
28c28f075b
Merge pull request #1414 from azat/build/deprecate-autotools
Deprecate autotools build
2023-02-13 08:09:21 +01:00
Azat Khuzhin
1df2a5a69e test: enable allocator_may_return_null=1 for calloc with ENOMEM test 2023-02-12 21:55:40 +01:00
Azat Khuzhin
207ea62bf9 test: handle -v as --verbose for regress 2023-02-12 21:55:40 +01:00
Azat Khuzhin
0ea2058252 test: add del_wait/del_notify tests for windows
Test manually, since CI is too slow
2023-02-12 21:54:45 +01:00
Azat Khuzhin
c437b84adb Remove extra builds for autotools on CI
We have almost the same matrix for cmake and autotools, but autotools is
considered to be deprecated from now on, plus our CI takes too much
time, especially non-linux, since we are using public infrastucture.

So let's remove extra builds.
2023-02-12 16:30:03 +01:00
Azat Khuzhin
f7e39d2e9b ci: bump cache and checkout plugins 2023-02-12 16:30:03 +01:00
Azat Khuzhin
b5a6940df2 ci: fix paths-ignore 2023-02-12 16:30:03 +01:00
Azat Khuzhin
7e6d9b0b17 .github/workflows/build.yml: remove trailing whitespaces 2023-02-12 16:30:03 +01:00
Azat Khuzhin
866b751b71 Deprecate autotools build 2023-02-12 16:30:03 +01:00
Edoardo Lolletti
765fb4108d
Fix compilation on non recent windows SDKs (#1399)
In commit f8bb9d8 the header stringapiset.h was included, very likely because the user who made the change saw that the funciton WideCharToMultiByte is "declared" in there.
That header tho is a recent addition to the windows headers added in the last years in an attempt from microsoft to split the windows.h header in multiple files, so the inclusion fails when the library is not built with the latest visual studio using the latest windows 10 sdk.
That inclusion can be safely removed as in any case the function WideCharToMultiByte was already included by the windows.h header that is included few lines below.
2023-02-12 16:19:35 +01:00
Azat Khuzhin
61de8a07c5
test: fix leaks in bufferevent_pair_release_lock (#1413) 2023-02-12 15:47:16 +01:00
Azat Khuzhin
a82b77bbc7 Remove suppression for test_ok under TSan
There is no such tests yet.
2023-02-12 11:27:28 +01:00
Azat Khuzhin
b5a5fbb81d Merge branch 'tests-fixes'
* tests-fixes:
  Add more ignore rules
  test: fix debug locks in case new lock gots old address
  test: suppress logs from the tests that produce them under normal circumstances
  test: fix TT_* flags values
  Suppress data race for test_ok variable
  Suppress data race for event_debug_created_threadable_ctx_ variable
2023-02-12 08:50:05 +01:00
Azat Khuzhin
b99106f3fd Add more ignore rules
- for clangd
- and compile_commands.json for it
2023-02-12 08:49:53 +01:00
Azat Khuzhin
c257e16f5b test: fix debug locks in case new lock gots old address
Refs: #1407
2023-02-12 08:49:47 +01:00
Azat Khuzhin
fb900a284f test: suppress logs from the tests that produce them under normal circumstances 2023-02-12 08:39:20 +01:00
Azat Khuzhin
1201bb8529 test: fix TT_* flags values 2023-02-12 08:39:00 +01:00
Azat Khuzhin
f0cb4b7f57 Suppress data race for test_ok variable 2023-02-12 08:39:00 +01:00
Azat Khuzhin
39be38ff79 Suppress data race for event_debug_created_threadable_ctx_ variable 2023-02-12 08:39:00 +01:00
Edoardo Lolletti
f9134df7d0
Add LEV_OPT_BIND_IPV4_AND_IPV6 flag (#1400)
Libevent introduced the LEV_OPT_BIND_IPV6ONLY to pass to evconnlistener_new_bind to make it automatically set the underlying socket as accepting ipv6 requests. This works fine on posix compliant platforms as by the standard every new AF_INET6 socket is created as both supporting ipv6 and ipv4 connections. But on windows the default is the opposite, with the flag IPV6_V6ONLY  being always enabled by default.

This makes creating a listener to supports both protocols a bit more tricky as winsock doesn't allow changing this flag after evconnlistener_new_bind does all the initial setup because as stated in the docs, you can't change it after the sonnect connected, so one would have to manually create the socket beforehand and set the flag and then call evconnlistener_new with the socket itself.

It would be nice to have libevent keep a consistent behaviour across the platforms in this scenario, maybe or by making it always set IPV6_V6ONLY  to false unless LEV_OPT_BIND_IPV6ONLY is passed, in which case it's set to true, or add another flag to forcefully set it to false and keep the system dependent behaviour as default.

So this patch add new option for libevent listeners to bind to both - LEV_OPT_BIND_IPV4_AND_IPV6
2023-02-04 15:00:48 +01:00
Azat Khuzhin
a5b0ded3c9 Add config for vim/nvim 2023-02-04 14:56:53 +01:00
Azat Khuzhin
4d85d28acd Fix pthread detection for regress tests on Android
Fixes: #1403
2023-01-28 13:28:52 +01:00
Azat Khuzhin
35375101e7 Fixes some new warnings under clang-15
- -Wdeprecated-non-prototype

  /src/le/libevent/strlcpy.c:48:1: warning: a function definition without a prototype is deprecated in all versions of C and is not supported in C2x [-Wdeprecated-non-prototype]
  event_strlcpy_(dst, src, siz)

- -Wstrict-prototypes

  /src/le/libevent/evthread.c:82:70: warning: a function declaration without a prototype is deprecated in all versions of C [-Wstrict-prototypes]
  struct evthread_condition_callbacks *evthread_get_condition_callbacks()

- -Wunused-but-set-variable

  /src/le/libevent/test/regress_buffer.c:130:6: warning: variable 'n' set but not used [-Wunused-but-set-variable]
          int n = 0;
                                                                     ^
2023-01-27 08:58:51 +01:00
Azat Khuzhin
3d138bda11 Allow evdns_base_new to succeed with no nameservers configured (#1389)
* evdns-no-ns:
  Allow evdns_base_new to succeed with no nameservers configured
  Replace magic numbers with consts for evdns_base_resolv_conf_parse() errors
2023-01-27 08:51:56 +01:00
Daniel Kempenich
ebd7e8d793 Allow evdns_base_new to succeed with no nameservers configured
If resolv.conf has no nameservers, evdns_base_new can still succeed with
the default of using the name server from localhost matching the man
page documentation for resolv.conf.
2023-01-27 08:50:29 +01:00
Daniel Kempenich
a7fffb5c0f Replace magic numbers with consts for evdns_base_resolv_conf_parse() errors 2023-01-27 08:47:01 +01:00
liaotonglang
c01cb1d685 Fix ignoring return value of arc4random() warning (with _FORTIFY_SOURCE defined)
arc4random() defines with __wur (warn-unused-return) macro in glibc, but
the problem pops up only for gentoo, since only it really define __wur
to __attribute__ ((__warn_unused_result__)), because it defines
_FORTIFY_SOURCE unconditionally [1].

  [1]: https://gitweb.gentoo.org/proj/gcc-patches.git/tree/9.4.0/gentoo/01_all_default-fortify-source.patch?id=7f7f80a650607c3090ae0790b8daef88434da681

And hence you get this error:

```sh
docker run -v $PWD:/src:ro --rm --name le -w /src -it gentoo/stage3 bash -c 'mkdir /build && cd /build && /src/configure --enable-gcc-warnings=yes --disable-samples && make -j && echo OK'
/src/evutil_rand.c: In function 'evutil_secure_rng_init':
/src/evutil_rand.c:56:16: error: ignoring return value of 'arc4random' declared with attribute 'warn_unused_result' [-Werror=unused-result]
   56 |         (void) arc4random();
      |                ^~~~~~~~~~~~
cc1: all warnings being treated as errors
make[1]: *** [Makefile:2056: evutil_rand.lo] Error 1
make[1]: *** Waiting for unfinished jobs....
make[1]: Leaving directory '/build'
make: *** [Makefile:1523: all] Error 2
```

Also it seems that GCC works as expected here [2], and will not change
the behavior.

  [2]: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66425
2023-01-22 16:22:58 +01:00
Azat Khuzhin
94cc08fde2 Add CTestCostData.txt to gitignore 2023-01-15 20:56:56 +01:00
Dmitry Antipov
0b79a0024f buffer: use pread() for evbuffer_file_segment_materialize()
If pread(2) is available, prefer it over double lseek(2)
and read(2) in evbuffer_file_segment_materialize().

Signed-off-by: Dmitry Antipov <dantipov@cloudlinux.com>
2023-01-02 17:12:14 +03:00
mdavidsaver
1fe626c4da
Allow CLI override of CMAKE_DEBUG_POSTFIX (#1391)
Allows cmake -DCMAKE_BUILD_TYPE=DEBUG -DCMAKE_DEBUG_POSTFIX= for a debug build with the regular library names.
2022-12-16 11:34:25 +03:00
DavidKorczynski
d8ecb88f12
ci: add CIFuzz Github action (#1382)
Signed-off-by: David Korczynski <david@adalogics.com>
Co-authored-by: Azat Khuzhin <a3at.mail@gmail.com>
2022-11-26 22:40:02 +03:00
Azat Khuzhin
dfbb004a4a Fix script for updating contributors 2022-11-20 23:11:42 +01:00
Azat Khuzhin
82af0ea4ee cmake: remove redundant _GNU_SOURCE definition
As reported by @francoisk:

    `_GNU_SOURCE` is defined in the private config header but also on the
    compiler command-line for every object.

Fixes: #1333
2022-11-20 22:19:21 +01:00
Azat Khuzhin
097af7b756 Merge branch 'release-2.2-changelog-prepare'
* release-2.2-changelog-prepare:
  Changelog skeleton
  Start new changelog for 2.2
2022-11-20 21:52:49 +01:00
Azat Khuzhin
d179ae923c Changelog skeleton 2022-11-20 21:52:12 +01:00
Azat Khuzhin
f40642eeb5 Start new changelog for 2.2 2022-11-20 21:51:48 +01:00
Azat Khuzhin
e28b3befa1 Merge branch 'release-scripts'
* release-scripts:
  Add a script to generate changelog
  Add a script to add new contributors
  Rellocate some text in CONTRIBUTORS.md
2022-11-20 21:50:40 +01:00
Azat Khuzhin
acd4cc63e8 Add a script to generate changelog 2022-11-20 21:50:27 +01:00
Azat Khuzhin
7c8b3e9967 Add a script to add new contributors 2022-11-20 21:50:27 +01:00
Azat Khuzhin
d130d9f918 Rellocate some text in CONTRIBUTORS.md 2022-11-20 21:50:27 +01:00
Azat Khuzhin
650d861969 cmake: do influence CMAKE_DEBUG_POSTFIX of the outer project (if any)
Consider the following example:

    $ touch lib.c
    $ cat > CMakeLists.txt <<EOL
    add_subdirectory(/src/le/libevent libevent EXCLUDE_FROM_ALL)
    add_library(lib lib.c)
    EOL
    $ mkdir .cmake
    $ cmake -DCMAKE_BUILD_TYPE=debug -G Ninja ..
    $ ninja
    $ ls *.a
    liblibd.a

So now outer project also has "d" prefix for libraries.

Let's avoid this by setting non-cached variable.

Fixes: #1371
2022-11-20 14:54:08 +01:00
Dmitry Ilyin
ed079c9fe7
Add ws-chat-server to gitignore (#1376) 2022-11-16 22:06:06 +03:00
Srivatsan Iyer
7a18af8c8e
Exclude arc4random_buf implementation if it's already present in the platform (#1375)
This patch excludes definition of arc4random_buf on systems where it is already present. When the symbol is found, the macro EVENT__HAVE_ARC4RANDOM_BUF is set via CMake's configure_file(..).

Co-authored-by: Azat Khuzhin <a3at.mail@gmail.com>
2022-11-15 10:08:41 +03:00
Azat Khuzhin
cdeb324226 Various documentation improvements (#842)
* doc-pull:
  doc: add build prerequisites
  doc: add MSVC and GNUC options

Fixes: #843
2022-11-13 14:05:43 +01:00
yuangongji
3d82675e37 doc: add build prerequisites
[ci skip]
2022-11-13 14:05:02 +01:00
yuangongji
a3973a5a53 doc: add MSVC and GNUC options 2022-11-13 13:59:39 +01:00
mkm
8800b17a3d evdns: integrate deferred_response_callback into evdns_request
the allocation of the struct deferred_reply_callback can fail. If that
happens a program waiting for a callback never gets a callback. The
program would asume that it either gets an error or a callback when e.g.
calling evdns_base_resolve_ipv6.

I did an analysis of the evdns.c code and concluded that struct
evdns_request would live until the callback is executed. Based on that
conclusion I removed the struct deferred_reply_callback and moved the
neccessary fields for data which should be copied from struct request
into struct evdns_request.

The fields evdns_callback_type user_callback and void *user_pointer are
moved into struct evdns_request as it is a more natural place for them
to live than struct request.
2022-11-13 13:47:52 +01:00