4964 Commits

Author SHA1 Message Date
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
neil
45c66e4879
Add CI checks for OpenBSD (#1326)
Initially 6.9 and 7.1 had been added, however due to some issues (you can read
about them below) 6.9 had been disabled.

netbsd 6.9 does not have correct library namings for autotools:

    2022-08-17T04:59:58.8339420Z libtool: link: (cd ".libs" && rm -f "libevent.so.1.0" && ln -s "libevent-2.2.so.1.0" "libevent.so.1.0")

    $ grep ^library_names= libevent.la·
    library_names='libevent-2.2.so.1.0 libevent.so.1.0'

    # And this is wrong, it should be:
    libtool: link: (cd ".libs" && rm -f "libevent-2.2.so.1" && ln -s "libevent-2.2.so.1.0.0" "libevent-2.2.so.1")
    libtool: link: (cd ".libs" && rm -f "libevent.so" && ln -s "libevent-2.2.so.1.0.0" "libevent.so")
    library_names='libevent-2.2.so.1.0.0 libevent-2.2.so.1 libevent.so'

**And I think that 7.1 should also fail, however it has system-wide libevent installed with evdns in the libevent.so**

Also there are some issues with `TEST_EXPORT_SHARED` test, because of libraries naming:

    2022-09-13T06:38:29.2150790Z [test-export] test for install tree(in system-wide path)
    2022-09-13T06:38:29.2151500Z [test-export] fail: link core and run core expects success but gets failure.
    2022-09-13T06:38:29.2063870Z /usr/bin/cc CMakeFiles/test-export.dir/test-export.c.o -o test-export   -L/usr/local/lib  -Wl,-z,origin,-rpath,/usr/local/lib -levent_core-2.2 -lpthread -Wl,-rpath-link,/usr/X11R6/lib:/usr/local/lib·
    2022-09-13T06:38:29.2152190Z ld: error: unable to find library -levent_core-2.2

    2022-09-13T06:38:28.3915680Z -- Install configuration: "Release"
    2022-09-13T06:38:28.3916700Z -- Up-to-date: /usr/local/lib/libevent_core-2.2.so.1.0.0
    2022-09-13T06:38:28.3917110Z -- Up-to-date: /usr/local/lib/libevent_core-2.2.so.1
    2022-09-13T06:38:28.3917480Z -- Up-to-date: /usr/local/lib/libevent_core.so
    # no libevent_core-2.2.so

So I have to disable it too.

Co-authored-by: Azat Khuzhin <azat@libevent.org>
2022-11-13 15:39:17 +03:00
Dmitry Antipov
1af745d033 signal: new signal handling backend based on signalfd
Linux-specific signal handling backend based on signalfd(2)
system call, and public function event_base_get_signal_method()
to obtain an underlying kernel signal handling mechanism.

Signed-off-by: Dmitry Antipov <dantipov@cloudlinux.com>
2022-11-12 21:14:48 +01:00
Azat Khuzhin
9e346936d4 Ignore unknown pragmas
Since new compilers has new checks (like -Wdangling-pointer), and so to
avoid extra checks in cmake/autotools, simply suppress if the pragma is
unknown.
2022-11-12 19:00:10 +01:00
Azat Khuzhin
72a4fe76fc ws-chat-server: fix session name initialization (using of uninitialized data) 2022-11-12 19:00:10 +01:00
Azat Khuzhin
c8c730c8dc cmake: tiny cleanup 2022-11-12 18:56:03 +01:00
Azat Khuzhin
56d380b9b6 ws: ignore case while comparing values of Upgrade/Connection headers
Cc: @widgetii
Fixes: #1373
2022-11-12 18:46:43 +01:00
Azat Khuzhin
8482e227a8 ws-chat-server: avoid SIGSEGV in case of evws_new_session() failure 2022-11-12 18:44:44 +01:00
Azat Khuzhin
dda05f45e7 sample/ws-chat.html: allow to open it via file:// protocol 2022-11-12 18:11:08 +01:00