]> granicus.if.org Git - libevent/log
libevent
4 years agotest: fix leak in dns/getaddrinfo_cancel_stress
Azat Khuzhin [Sun, 5 Jul 2020 08:59:32 +0000 (11:59 +0300)]
test: fix leak in dns/getaddrinfo_cancel_stress

Some requests may get response (evutil_addrinfo) from gaic_server_cb,
in case of cancel_event (10000ms) will not be fast enough.

4 years agotest: fix UB in evbuffer/empty_reference_prepend_buffer
Azat Khuzhin [Sun, 5 Jul 2020 08:45:56 +0000 (11:45 +0300)]
test: fix UB in evbuffer/empty_reference_prepend_buffer

UBSAN reports:
  test/regress_buffer.c:2360:2: runtime error: null pointer passed as argument 1, which is declared to never be null
  /usr/include/string.h:140:33: note: nonnull attribute specified here

4 years agoci: set build type to debug with sanitizers
Azat Khuzhin [Sun, 5 Jul 2020 08:21:04 +0000 (11:21 +0300)]
ci: set build type to debug with sanitizers

4 years agotest: really disable bufferevent_pair_release_lock under ASAN (and fix gcc)
Azat Khuzhin [Sun, 5 Jul 2020 08:14:18 +0000 (11:14 +0300)]
test: really disable bufferevent_pair_release_lock under ASAN (and fix gcc)

4 years agotest-closed: fix leak
Azat Khuzhin [Sun, 5 Jul 2020 08:08:05 +0000 (11:08 +0300)]
test-closed: fix leak

4 years agobuild: do not disable deprecation warnings on macOS
Pierce Lopez [Sat, 4 Jul 2020 19:55:22 +0000 (15:55 -0400)]
build: do not disable deprecation warnings on macOS

this was for using openssl-0.9.8 included in macOS 10.7 - 10.12,
but it is long since time you really should not use that openssl

4 years agoMerge #1046 -- build: misc configure changes
Azat Khuzhin [Fri, 3 Jul 2020 06:27:20 +0000 (09:27 +0300)]
Merge #1046 -- build: misc configure changes

* upstream/pr/1046:
  build: consolidate darwin compile flag additions in configure
  build: consistently use dnl for comments in configure.ac

4 years agoAdd abi-check report into artifacts
Azat Khuzhin [Sun, 28 Jun 2020 14:10:03 +0000 (17:10 +0300)]
Add abi-check report into artifacts

4 years agobuild: consolidate darwin compile flag additions in configure
fanquake [Sun, 28 Jun 2020 10:40:26 +0000 (18:40 +0800)]
build: consolidate darwin compile flag additions in configure

This is mostly move-only, apart from some changes to comments.

4 years agobuild: consistently use dnl for comments in configure.ac
fanquake [Sun, 28 Jun 2020 10:30:54 +0000 (18:30 +0800)]
build: consistently use dnl for comments in configure.ac

4 years agotest: add getaddrinfo(AI_ADDRCONFIG) test (off by default)
Azat Khuzhin [Fri, 26 Jun 2020 07:35:44 +0000 (10:35 +0300)]
test: add getaddrinfo(AI_ADDRCONFIG) test (off by default)

4 years agobuild: remove duplicate -Wredundant-decls
fanquake [Fri, 26 Jun 2020 06:35:41 +0000 (14:35 +0800)]
build: remove duplicate -Wredundant-decls

4 years agoMerge branch 'tests-under-sanitizers'
Azat Khuzhin [Thu, 25 Jun 2020 20:16:16 +0000 (23:16 +0300)]
Merge branch 'tests-under-sanitizers'

* tests-under-sanitizers:
  test: fix memory leaks for https (add BEV_OPT_CLOSE_ON_FREE)
  test: "fix" (with a quirk) leak in ssl/bufferevent_wm (w/o defer callbacks)
  test: disable bufferevent/bufferevent_pair_release_lock under ASAN (too tricky)
  test: detect test failures if atexit handler calls _exit(!0) (sanitizers)
  Add LSAN suppressions (for OpenSSL temporary quirk)
  Add TSAN suppressions
  ci: run tests under sanitizers

Fixes: #955
4 years agotest: fix memory leaks for https (add BEV_OPT_CLOSE_ON_FREE)
Azat Khuzhin [Thu, 25 Jun 2020 18:56:31 +0000 (21:56 +0300)]
test: fix memory leaks for https (add BEV_OPT_CLOSE_ON_FREE)

- http/https_filter_basic
- http/https_filter_chunk_out

4 years agotest: "fix" (with a quirk) leak in ssl/bufferevent_wm (w/o defer callbacks)
Azat Khuzhin [Thu, 25 Jun 2020 18:40:40 +0000 (21:40 +0300)]
test: "fix" (with a quirk) leak in ssl/bufferevent_wm (w/o defer callbacks)

4 years agotest: disable bufferevent/bufferevent_pair_release_lock under ASAN (too tricky)
Azat Khuzhin [Thu, 25 Jun 2020 18:25:51 +0000 (21:25 +0300)]
test: disable bufferevent/bufferevent_pair_release_lock under ASAN (too tricky)

And cannot be suppressed with suppressions due to setup routines.

4 years agotest: detect test failures if atexit handler calls _exit(!0) (sanitizers)
Azat Khuzhin [Thu, 25 Jun 2020 18:01:53 +0000 (21:01 +0300)]
test: detect test failures if atexit handler calls _exit(!0) (sanitizers)

tinytest uses another way of detecting test failures, it uses pipe
between child and parent, and if the test function in child returns OK
it writes OK flag into pipe, and reads it in parent.

However sanitizers uses atexit handlers to detect leaks, and this will
not detect failures in case of exit() will be called from the atexit
handlers, fix this by checking status after waitpid().

4 years agoAdd LSAN suppressions (for OpenSSL temporary quirk)
Azat Khuzhin [Thu, 25 Jun 2020 18:34:02 +0000 (21:34 +0300)]
Add LSAN suppressions (for OpenSSL temporary quirk)

4 years agoAdd TSAN suppressions
Azat Khuzhin [Thu, 25 Jun 2020 18:01:53 +0000 (21:01 +0300)]
Add TSAN suppressions

4 years agoci: run tests under sanitizers
Azat Khuzhin [Thu, 25 Jun 2020 18:01:53 +0000 (21:01 +0300)]
ci: run tests under sanitizers

Added:
- ASAN
- TSAN
- UBSAN

And disable some tests that are know to have leaks.

4 years agoMake all classes Entry, Struct, etc) new-style classes
Enji Cooper [Thu, 25 Jun 2020 15:08:10 +0000 (08:08 -0700)]
Make all classes Entry, Struct, etc) new-style classes

This allows the object methods to be properly inherited and called via
`super(..)`, addressing breakage with python 2.x, introduced in
cfcc093606e747a5d250787012bac0b149c60d6d.

Fixes #1042.

Signed-off-by: Enji Cooper <yaneurabeya@gmail.com>
4 years agoevdns: do not pass NULL to memcpy() in evdns_server_request_format_response()
Azat Khuzhin [Thu, 25 Jun 2020 07:18:43 +0000 (10:18 +0300)]
evdns: do not pass NULL to memcpy() in evdns_server_request_format_response()

In case of OPT pseudo-RR `class` field is treated as a requestor's UDP
payload size, and class will have 512 (DNS_MAX_UDP_SIZE), and data is
NULL:

  (gdb) p *item
  $4 = {
    next = 0x0,
    name = 0x602000000130 "",
    type = 41,
    class = 512,
    ttl = 0,
    is_name = 0 '\000',
    datalen = 0,
    data = 0x0
  }

And UBSAN will reports:

  ../evdns.c:2493:5: runtime error: null pointer passed as argument 2, which is declared to never be null
      #0 0x7ffff70b65bb in evdns_server_request_format_response ../evdns.c:2493
      #1 0x7ffff70b706b in evdns_server_request_respond ../evdns.c:2529
      #2 0x5555557975ab in regress_dns_server_cb ../test/regress_testutils.c:263
      #3 0x7ffff70a8489 in request_parse ../evdns.c:1576
      #4 0x7ffff70aa445 in server_udp_port_read ../evdns.c:1726
      #5 0x7ffff70ac5cc in server_port_ready_callback ../evdns.c:1849
      #6 0x7ffff6d3054c in event_persist_closure ../event.c:1645
      #7 0x7ffff6d311cd in event_process_active_single_queue ../event.c:1704
      #8 0x7ffff6d33258 in event_process_active ../event.c:1805
      #9 0x7ffff6d361b5 in event_base_loop ../event.c:2047
      #10 0x7ffff6d334ac in event_base_dispatch ../event.c:1839
      #11 0x555555739df2 in test_edns ../test/regress_dns.c:2639
      #12 0x5555557b9e96 in testcase_run_bare_ ../test/tinytest.c:173
      #13 0x5555557ba8f0 in testcase_run_one ../test/tinytest.c:333
      #14 0x5555557bc9a0 in tinytest_main ../test/tinytest.c:527
      #15 0x555555787faa in main ../test/regress_main.c:528
      #16 0x7ffff606c001 in __libc_start_main (/usr/lib/libc.so.6+0x27001)
      #17 0x55555569436d in _start (/src/le/libevent/.cmake-debug/bin/regress+0x14036d)

4 years agobuffer: do not pass NULL to memcpy() from evbuffer_pullup()
Azat Khuzhin [Thu, 25 Jun 2020 07:15:01 +0000 (10:15 +0300)]
buffer: do not pass NULL to memcpy() from evbuffer_pullup()

UBSAN reports:

  evbuffer/remove_buffer_with_empty3: ../buffer.c:1443:3: runtime error: null pointer passed as argument 2, which is declared to never be null
      #0 0x7ffff6cd0410 in evbuffer_pullup ../buffer.c:1443
      #1 0x5555556d68b9 in test_evbuffer_remove_buffer_with_empty3 ../test/regress_buffer.c:408
      #2 0x5555557b95ee in testcase_run_bare_ ../test/tinytest.c:173
      #3 0x5555557ba048 in testcase_run_one ../test/tinytest.c:333
      #4 0x5555557bc0f8 in tinytest_main ../test/tinytest.c:527
      #5 0x555555787702 in main ../test/regress_main.c:528
      #6 0x7ffff606c001 in __libc_start_main (/usr/lib/libc.so.6+0x27001)
      #7 0x55555569436d in _start (/src/le/libevent/.cmake-debug/bin/regress+0x14036d)

4 years agotest: do not pass NULL to memcmp() in evbuffer_datacmp() helper
Azat Khuzhin [Thu, 25 Jun 2020 06:59:35 +0000 (09:59 +0300)]
test: do not pass NULL to memcmp() in evbuffer_datacmp() helper

Fixes:
  runtime error: null pointer passed as argument 2, which is declared to never be null

4 years agohttp: fix undefined-shift in EVUTIL_IS*_ helpers
Azat Khuzhin [Thu, 25 Jun 2020 05:45:34 +0000 (08:45 +0300)]
http: fix undefined-shift in EVUTIL_IS*_ helpers

evutil.c:2559:1: runtime error: left shift of 1 by 31 places cannot be represented in type 'int'
    #0 0x4f2be0 in EVUTIL_ISXDIGIT_ libevent/evutil.c:2559:1
    #1 0x4bd689 in regname_ok libevent/http.c:4838:7
    #2 0x4bc16b in parse_authority libevent/http.c:4958:9
    #3 0x4bb8b5 in evhttp_uri_parse_with_flags libevent/http.c:5103:7
    #4 0x4bb762 in evhttp_uri_parse libevent/http.c:5050:9
    #5 0x4b8f41 in evhttp_parse_query_impl libevent/http.c:3505:9
    #6 0x4b8ed7 in evhttp_parse_query libevent/http.c:3569:9

Bug: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=23291
Report: https://oss-fuzz.com/testcase-detail/5670743106125824

4 years agoCheck error code of evhttp_add_header_internal() in evhttp_parse_query_impl()
Azat Khuzhin [Thu, 25 Jun 2020 06:08:31 +0000 (09:08 +0300)]
Check error code of evhttp_add_header_internal() in evhttp_parse_query_impl()

4 years agowepoll: use lower-cased windows headers
fanquake [Mon, 22 Jun 2020 11:40:06 +0000 (19:40 +0800)]
wepoll: use lower-cased windows headers

This matches their use throughout the rest of the project, and fixes the
build when you are cross-compiling on Linux using mingw-w64. i.e:

  CC       epoll.lo
  CC       wepoll.lo
  CC       signal.lo
wepoll.c:138:10: fatal error: WS2tcpip.h: No such file or directory
 #include <WS2tcpip.h>
          ^~~~~~~~~~~~
compilation terminated.
make[2]: *** [Makefile:1918: wepoll.lo] Error 1

4 years agocmake: avoid problems from use of CMAKE_USE_PTHREADS_INIT
Paul Osborne [Thu, 18 Jun 2020 15:47:14 +0000 (15:47 +0000)]
cmake: avoid problems from use of CMAKE_USE_PTHREADS_INIT

In some CMake integrations, portions of the toolchain may end up
defining CMAKE_USE_PTHREADS_INIT even when EVENT__DISABLE_THREAD_SUPPORT
is set for libevent.  Modify the build to not rely on this side effect
of find_package(Threads, ...) [which could be done elsewhere] but instead
to use EVENT__HAVE_PTHREADS which is defined only on the desired codepath.

Without this change, affected builds fail as a result of event_pthreads source
files being built but with build defines which cause the build to fail.

Signed-off-by: Paul Osborne <paul.osborne@smartthings.com>
4 years agorecreate socket when udp failed
okhowang(王沛文) [Thu, 28 May 2020 09:32:05 +0000 (17:32 +0800)]
recreate socket when udp failed

4 years agotest/regress_http: remove second ARRAY_SIZE macros
Azat Khuzhin [Tue, 2 Jun 2020 07:12:20 +0000 (10:12 +0300)]
test/regress_http: remove second ARRAY_SIZE macros

4 years agotest/regress_testutils: use inet_addr()
Azat Khuzhin [Tue, 2 Jun 2020 07:01:31 +0000 (10:01 +0300)]
test/regress_testutils: use inet_addr()

4 years agotest/regress_dns: use tt_int_op() over tt_assert() in assert_request_results()
Azat Khuzhin [Tue, 2 Jun 2020 07:00:38 +0000 (10:00 +0300)]
test/regress_dns: use tt_int_op() over tt_assert() in assert_request_results()

4 years agoevdns: Add support for setting maximum UDP DNS message size.
seleznevae [Sun, 31 May 2020 16:59:49 +0000 (19:59 +0300)]
evdns: Add support for setting maximum UDP DNS message size.

Added new option `edns-udp-size` for evdns_base which allows
to control maximum allowed size of UDP DNS messages. This
maximum size is passed to the DNS server via edns mechanism.

4 years agoCI: catch failures and retry
yuangongji [Thu, 28 May 2020 03:50:49 +0000 (11:50 +0800)]
CI: catch failures and retry

4 years agoremove FindGit.cmake, improve `git describe` command
yuangongji [Wed, 27 May 2020 07:39:49 +0000 (15:39 +0800)]
remove FindGit.cmake, improve `git describe` command

4 years agocheckpatch.sh: fix clang-format-diff usage
Azat Khuzhin [Wed, 27 May 2020 17:33:25 +0000 (20:33 +0300)]
checkpatch.sh: fix clang-format-diff usage

- strip 1 path component
- it does not accept file name anymore, only stdin

Refs: #1029

4 years agocheckpatch.sh: fix usage
Azat Khuzhin [Wed, 27 May 2020 17:31:29 +0000 (20:31 +0300)]
checkpatch.sh: fix usage

Refs: #1029

4 years agoFix clang-format-diff usage
Wataru Ashihara [Wed, 27 May 2020 15:03:03 +0000 (00:03 +0900)]
Fix clang-format-diff usage

"--style" is invalid:

$ ./checkpatch.sh -r HEAD
usage: clang-format-diff [-h] [-i] [-p NUM] [-regex PATTERN] [-iregex PATTERN]
                         [-sort-includes] [-v] [-style STYLE] [-binary BINARY]
clang-format-diff: error: unrecognized arguments: --style={ Language:... }

4 years agohttp: Merge branch 'http-max_connections-pr-592'
Azat Khuzhin [Mon, 25 May 2020 08:25:18 +0000 (11:25 +0300)]
http: Merge branch 'http-max_connections-pr-592'

@jcoffland:

  "When the max connection limit is enabled and the limit is reached, the
   server will respond immediately with 503 Service Unavailable. This can
   be used to prevent servers from running out of file descriptors. This is
   better than request limiting because clients may make more than one
   request over a single connection. Blocking a request does not
   necessarily close the connection and free up a socket."

* http-max_connections-pr-592:
  test: cover evhttp max connections
  Added evhttp max simultaneous connection limiting

4 years agotest: cover evhttp max connections
Azat Khuzhin [Mon, 25 May 2020 00:34:16 +0000 (03:34 +0300)]
test: cover evhttp max connections

4 years agovariable redefinition in win32_dispatch
mohuang [Mon, 25 May 2020 02:33:24 +0000 (10:33 +0800)]
variable redefinition in win32_dispatch

4 years agoMerge branch 'evdns-tcp-pr-1004'
Azat Khuzhin [Mon, 25 May 2020 00:13:00 +0000 (03:13 +0300)]
Merge branch 'evdns-tcp-pr-1004'

@seleznevae:

  "Added support for DNS requests via TCP. By default, requests are done
   via UDP. In case truncated response is received new attempt is done
   via TCP connection. Added 2 new macros DNS_QUERY_USEVC and
   DNS_QUERY_IGNTC to force all requests to be done via TCP and to disable
   switch to TCP in case of truncated responses.

   Also added possibility for DNS server to listen and receive requests on
   TCP port. Current implementation of TCP support in DNS server seems
   rather preliminary and maybe changes after discussion and code review.

   Fallback to TCP in case of truncated DNS requests is done automatically.
   To imitate the old behaviour macros DNS_QUERY_IGNTC should be used. To
   force all DNS requests to be done via TCP one should use the flag
   DNS_QUERY_USEVC. Names DNS_QUERY_IGNTC, DNS_QUERY_USEVC were chosen to
   imitate similar flags in c-ares and glibc."

Ok, interfaces looks good, merging to avoid stalling it for too long.

* evdns-tcp-pr-1004:
  evdns: fix coding style issues
  evdns: fix trailing whitespaces
  evdns: bufferevent_setcb before bufferevent_free is redundant
  evdns: Implement dns requests via tcp

4 years agoevdns: fix coding style issues
Azat Khuzhin [Mon, 25 May 2020 00:06:43 +0000 (03:06 +0300)]
evdns: fix coding style issues

4 years agoevdns: fix trailing whitespaces
Azat Khuzhin [Sun, 24 May 2020 23:55:38 +0000 (02:55 +0300)]
evdns: fix trailing whitespaces

4 years agoevdns: bufferevent_setcb before bufferevent_free is redundant
Azat Khuzhin [Sun, 24 May 2020 23:35:55 +0000 (02:35 +0300)]
evdns: bufferevent_setcb before bufferevent_free is redundant

4 years agotest: http/autofree_connection cleanup
Azat Khuzhin [Sun, 24 May 2020 23:06:32 +0000 (02:06 +0300)]
test: http/autofree_connection cleanup

4 years agoevdns: Implement dns requests via tcp
ayuseleznev [Thu, 21 May 2020 09:46:20 +0000 (12:46 +0300)]
evdns: Implement dns requests via tcp

4 years agohttp: fix EVHTTP_CON_AUTOFREE in case of timeout (and some else)
Azat Khuzhin [Tue, 19 May 2020 08:45:43 +0000 (11:45 +0300)]
http: fix EVHTTP_CON_AUTOFREE in case of timeout (and some else)

Refs: #182

4 years agohttp: fix EVHTTP_CON_AUTOFREE in case of connection error
Azat Khuzhin [Mon, 18 May 2020 22:02:30 +0000 (01:02 +0300)]
http: fix EVHTTP_CON_AUTOFREE in case of connection error

Refs: #182

4 years agotest: cleanup http/autofree_connection
Azat Khuzhin [Mon, 18 May 2020 22:05:50 +0000 (01:05 +0300)]
test: cleanup http/autofree_connection

4 years agotest: fix http/autofree_connection
Azat Khuzhin [Mon, 18 May 2020 21:52:01 +0000 (00:52 +0300)]
test: fix http/autofree_connection

Refs: #182

4 years agoevdns: Add additional validation for values of dns options
ayuseleznev [Mon, 18 May 2020 11:10:28 +0000 (14:10 +0300)]
evdns: Add additional validation for values of dns options

4 years agoAdd wepoll support to light up the epoll backend on Windows
Nick Grifka [Thu, 23 Apr 2020 02:44:45 +0000 (19:44 -0700)]
Add wepoll support to light up the epoll backend on Windows

libevent is lacking a scalable backend on Windows. Let's leverage the wepoll
library until Windows comes up with an epoll/kqueue compete user mode API.

- All regress tests pass for standard wepoll
- These 2 tests fail intermittently for changelist wepoll, so disabling
  changelist wepoll for now
     http/cancel_inactive_server
     http/stream_in
- verify target on Windows runs tests for both wepoll and win32 backends
- wepoll backend preferred over win32 backend
- wepoll version 1.5.6

v2: cleaner backend abstraction. Disallow wepoll on MinGW/Cygwin.
v3: Add wepoll.h to dist
v4: Make sure wepoll source files are excluded from cygwin/mingw builds
v5: Keep win32 as default backend on windows.
v6: Include wepoll in mingw builds. Verified that regress tests pass w/ WEPOLL backend.
v7: Enable wepoll on mingw when building with cmake
v8: Add wepoll testrunner for autotools test target

4 years agotest: Fix test_simpleclose for Windows platform
Nick Grifka [Fri, 8 May 2020 04:14:13 +0000 (21:14 -0700)]
test: Fix test_simpleclose for Windows platform

Replace close with evutil_closesocket
Caught with PR #1006

4 years agoInclude details of the ABI compatibility report
Azat Khuzhin [Wed, 6 May 2020 00:03:27 +0000 (03:03 +0300)]
Include details of the ABI compatibility report

4 years agoAdd ABI compatibility report deploy
Azat Khuzhin [Tue, 5 May 2020 23:10:34 +0000 (02:10 +0300)]
Add ABI compatibility report deploy

Closes: #887
4 years agoabi-check: abi-monitor 1.10 does not support -make -j8 (1.12 supports though)
Azat Khuzhin [Tue, 5 May 2020 23:40:49 +0000 (02:40 +0300)]
abi-check: abi-monitor 1.10 does not support -make -j8 (1.12 supports though)

An error for 1.10 on ci:
  https://github.com/azat/libevent/runs/647860649?check_suite_focus=true#step:4:219

4 years agoDo not ignore anything in .github
Azat Khuzhin [Tue, 5 May 2020 23:09:51 +0000 (02:09 +0300)]
Do not ignore anything in .github

Fixes: 28eb0d91 ("github actions looks good - drop travis/appveyor (#951)")
4 years agoAdd API/ABI checker (using LVC)
yuangongji [Wed, 4 Sep 2019 15:09:13 +0000 (23:09 +0800)]
Add API/ABI checker (using LVC)

v2 (by azat):
- drop package installations
- use local .abi-check over $HOME/abi-check for build dir
- drop regex check, simply use default values (too complex otherwise)
- use sub-shell to avoid cd back
- add missing quotes
- make the style uniq across the whole file (no tabs for indent, copy-paste?)
- drop `set -x`, use `bash -x abi-check.sh` over
- drop EVENT_ABI_CHECK
- use /usr/bin/env bash as shebang
- use `find | xargs` over `cp $(grep -v)`
- adjust markdown syntax in abi-check/README.md
- adjust link to the publicly available documentation

v3 (by azat):
- docker image
- git check-ignore
- make -j8
- allow to change defaults

Refs: #887

4 years agoci/linux: add dist check
Azat Khuzhin [Tue, 5 May 2020 12:22:32 +0000 (15:22 +0300)]
ci/linux: add dist check

4 years agoUpdate list of cmake files for autotools dist archive
Azat Khuzhin [Tue, 5 May 2020 13:24:59 +0000 (16:24 +0300)]
Update list of cmake files for autotools dist archive

Fixes: #976
4 years agoci: change cache key for windows/mingw
Azat Khuzhin [Tue, 5 May 2020 11:57:59 +0000 (14:57 +0300)]
ci: change cache key for windows/mingw

Should fix the following current failures:
- 2020-05-04T22:32:02.9490248Z C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Microsoft\VC\v160\Microsoft.CppCommon.targets(231,5): error MSB6006: "cmd.exe" exited with code 3. [D:\a\libevent\libevent\build\regress.vcxproj]
- cmake : /usr/bin/sh: /C/hostedtoolcache/windows/Python/3.7.6/x64/python.exe: No such file or directory

P.S. I guess python has another path, but on my fork it is the same and
it passes.

4 years agoPass --quiet to the event_rcpgen.py (autotools already does this)
Azat Khuzhin [Tue, 5 May 2020 11:20:09 +0000 (14:20 +0300)]
Pass --quiet to the event_rcpgen.py (autotools already does this)

4 years agoDo not run CI if message contains "ci skip"
Azat Khuzhin [Tue, 5 May 2020 10:57:15 +0000 (13:57 +0300)]
Do not run CI if message contains "ci skip"

https://github.com/marketplace/actions/skip-based-on-commit-message

4 years agoThere is typo in GetAdaptersAddresses windows library. It should be iphlpapi.dll
Aleksandr-Melnikov [Tue, 5 May 2020 09:31:09 +0000 (10:31 +0100)]
There is typo in GetAdaptersAddresses windows library. It should be iphlpapi.dll

4 years agoSupport EV_CLOSED on linux for poll(2)
Azat Khuzhin [Mon, 4 May 2020 22:13:49 +0000 (01:13 +0300)]
Support EV_CLOSED on linux for poll(2)

Refs: #984

4 years agoFix EV_CLOSED detection/reporting (epoll only)
Azat Khuzhin [Mon, 4 May 2020 21:21:18 +0000 (00:21 +0300)]
Fix EV_CLOSED detection/reporting (epoll only)

- EV_CLOSED is EPOLLRDHUP in epoll
- EPOLLRDHUP reported w/o EPOLLHUP if the socket closed with shutdown(SHUT_WR)
- EPOLLRDHUP reported w/  EPOLLHUP if the socket closed with close()
  so in this case epoll backend will detect this event as error
  (EV_READ|EV_WRITE), since the epoll_ctl() will return EPOLLRDHUP with
  EPOLLHUP set, but this is not correct, let's fix this.

Fixes: #984
4 years agoMerge branch 'EV_CLOSED-and-EV_ET-fixes'
Azat Khuzhin [Mon, 4 May 2020 21:05:49 +0000 (00:05 +0300)]
Merge branch 'EV_CLOSED-and-EV_ET-fixes'

* EV_CLOSED-and-EV_ET-fixes:
  Avoid triggering wrong events with EV_ET set
  epoll: handle EV_ET for EV_CLOSED too
  test: cover EV_CLOSED with lots of possible scenarious
  test: rename simpleclose to simpleclose_rw (since it works via write/read)

4 years agoAvoid triggering wrong events with EV_ET set
Azat Khuzhin [Wed, 8 Apr 2020 23:16:15 +0000 (02:16 +0300)]
Avoid triggering wrong events with EV_ET set

For the event at least something except EV_ET should be set, so checking
ev->ev_events with "triggered" events is wrong, because EV_ET is always
passed (see epoll), since it will be filtered out if it is not set in
event.

4 years agoepoll: handle EV_ET for EV_CLOSED too
Azat Khuzhin [Wed, 8 Apr 2020 23:00:17 +0000 (02:00 +0300)]
epoll: handle EV_ET for EV_CLOSED too

4 years agotest: cover EV_CLOSED with lots of possible scenarious
Azat Khuzhin [Wed, 8 Apr 2020 21:30:57 +0000 (00:30 +0300)]
test: cover EV_CLOSED with lots of possible scenarious

- trigger *RDHUP via close() <-- has issues
- trigger *RDHUP via shutdown()
- EV_CLOSED
- EV_CLOSED|EV_PERSIST
- EV_CLOSED|EV_ET <!-- has issues
- EV_CLOSED|EV_ET|EV_PERSIST

4 years agotest: rename simpleclose to simpleclose_rw (since it works via write/read)
Azat Khuzhin [Wed, 8 Apr 2020 21:14:26 +0000 (00:14 +0300)]
test: rename simpleclose to simpleclose_rw (since it works via write/read)

4 years agogithub actions looks good - drop travis/appveyor (#951)
Azat Khuzhin [Mon, 4 May 2020 20:42:22 +0000 (23:42 +0300)]
github actions looks good - drop travis/appveyor (#951)

Actually right now github's VMs is better then travis/appveyor.

4 years agobufferevent: allow setting priority on socket and openssl type
Nicolas J. Bouliane [Sun, 3 May 2020 00:32:10 +0000 (00:32 +0000)]
bufferevent: allow setting priority on socket and openssl type

4 years agocmake: set a default value for LIBEVENT_STATIC_LINK
yuangongji [Fri, 1 May 2020 01:51:29 +0000 (09:51 +0800)]
cmake: set a default value for LIBEVENT_STATIC_LINK

4 years agoevutil_time: improve evutil_gettimeofday on Windows
Nick Grifka [Mon, 27 Apr 2020 22:02:25 +0000 (15:02 -0700)]
evutil_time: improve evutil_gettimeofday on Windows

If present, use GetSystemTimePreciseAsFileTime instead of
GetSystemTimeAsFileTime. Available since Windows 8.

4 years agobench: Allow backend method selection
Nick Grifka [Thu, 16 Apr 2020 19:08:02 +0000 (12:08 -0700)]
bench: Allow backend method selection

-l         list available methods
-m <name>  use method

4 years agocmake: missing test-closed binary
Azat Khuzhin [Tue, 7 Apr 2020 21:29:40 +0000 (00:29 +0300)]
cmake: missing test-closed binary

4 years agoMerge branch 'event_rpcgen.py-cleanup'
Azat Khuzhin [Sat, 28 Mar 2020 13:02:39 +0000 (16:02 +0300)]
Merge branch 'event_rpcgen.py-cleanup'

* event_rpcgen.py-cleanup:
  event_rpcgen.py: fix arguments-differ
  event_rpcgen.py: fix attribute-defined-outside-init
  event_rpcgen: suppress some warnings to make pylint clean
  Don't accumulate arguments in `Entry.GetTranslation`
  Fix improper string concatenations in lists
  Fix warnings regarding unused variables
  Don't override the `type` built-in
  Call `super` to call methods from the parent class
  Address `no-self-use` issues reported by pylint
  Run the code through the black formatter
  Reformat strings to template
  Add `argparse` support
  Precompile regular expressions
  Use bools instead of ints values where possible
  Rename all global variables to match the PEP8 spec
  Handle file pointers with context suite patterns
  Iterate over `tokens` with a for instead of while
  Fix indentation for `RpcGenError`
  Don't override `file` built-in
  Resolve variable name issues per PEP8
  Sort imports per PEP8

4 years agoevent_rpcgen.py: fix arguments-differ
Azat Khuzhin [Sat, 28 Mar 2020 13:01:46 +0000 (16:01 +0300)]
event_rpcgen.py: fix arguments-differ

4 years agoevent_rpcgen.py: fix attribute-defined-outside-init
Azat Khuzhin [Sat, 28 Mar 2020 12:58:57 +0000 (15:58 +0300)]
event_rpcgen.py: fix attribute-defined-outside-init

4 years agoevent_rpcgen: suppress some warnings to make pylint clean
Azat Khuzhin [Sat, 28 Mar 2020 12:58:36 +0000 (15:58 +0300)]
event_rpcgen: suppress some warnings to make pylint clean

4 years agoDon't accumulate arguments in `Entry.GetTranslation`
Enji Cooper [Sat, 28 Mar 2020 00:24:53 +0000 (17:24 -0700)]
Don't accumulate arguments in `Entry.GetTranslation`

Initialize `extradict` safely to avoid accumulating arguments in dict
objects passed in across calls.

Signed-off-by: Enji Cooper <yaneurabeya@gmail.com>
4 years agoFix improper string concatenations in lists
Enji Cooper [Sat, 28 Mar 2020 00:01:53 +0000 (17:01 -0700)]
Fix improper string concatenations in lists

This change adds commas between elements or explicitly concatenates the
strings, so the values are no longer concatenated by accident.

Signed-off-by: Enji Cooper <yaneurabeya@gmail.com>
4 years agoFix warnings regarding unused variables
Enji Cooper [Fri, 27 Mar 2020 23:56:16 +0000 (16:56 -0700)]
Fix warnings regarding unused variables

Prefix all unused variables with `_` to mute unused variable warnings
with flake8/pylint.

Signed-off-by: Enji Cooper <yaneurabeya@gmail.com>
4 years agoDon't override the `type` built-in
Enji Cooper [Fri, 27 Mar 2020 23:45:21 +0000 (16:45 -0700)]
Don't override the `type` built-in

Name the second parameter to `Entry(..)` `ent_type` to avoid overriding
the built-in.

Signed-off-by: Enji Cooper <yaneurabeya@gmail.com>
4 years agoCall `super` to call methods from the parent class
Enji Cooper [Fri, 27 Mar 2020 23:27:56 +0000 (16:27 -0700)]
Call `super` to call methods from the parent class

Not only does it make it clearer to the reader what the intent is behind
the code, it fixes MRO evaluation of classes if the parent-child
relationship is nonlinear.

Signed-off-by: Enji Cooper <yaneurabeya@gmail.com>
4 years agoAddress `no-self-use` issues reported by pylint
Enji Cooper [Fri, 27 Mar 2020 23:20:24 +0000 (16:20 -0700)]
Address `no-self-use` issues reported by pylint

Sprinkle around `@staticmethod` where need be and raise
`NotImplementedError` from `Entry.GetInitializer` instead of doing
similar with `assert`. `NotImplementedError` will provide a hint to
static analyzers that there are abstract methods which need to be
implemented, if they aren't, in subclasses.

Signed-off-by: Enji Cooper <yaneurabeya@gmail.com>
4 years agoRun the code through the black formatter
Enji Cooper [Fri, 27 Mar 2020 23:04:37 +0000 (16:04 -0700)]
Run the code through the black formatter

This resolves a number of flake8 issues as well as pylint issues. Not
all of the changes mesh between flake8/pylint though, so there are some
false positives, but it's better than before.

Signed-off-by: Enji Cooper <yaneurabeya@gmail.com>
4 years agoReformat strings to template
Enji Cooper [Fri, 27 Mar 2020 22:58:02 +0000 (15:58 -0700)]
Reformat strings to template

This change converts the existing code to use triple-quotes extensively,
in the end-goal of making the code to reformat with black more readable
before and after the change (black messes around with the formatting in
a less than desirable way).

Signed-off-by: Enji Cooper <yaneurabeya@gmail.com>
4 years agoAdd `argparse` support
Enji Cooper [Fri, 27 Mar 2020 05:29:43 +0000 (22:29 -0700)]
Add `argparse` support

This change converts raw parsing with `sys.argv` to its equivalent logic
with `argparse`.

It doesn't fully convert over all of the TODO items listed in the
comments, but it does provide some top-level structure which can be used
to drive down further improvements and structure.

Signed-off-by: Enji Cooper <yaneurabeya@gmail.com>
4 years agoPrecompile regular expressions
Enji Cooper [Fri, 27 Mar 2020 04:02:13 +0000 (21:02 -0700)]
Precompile regular expressions

This change boost performance at scale by pre-compiling regular
expressions in the global space, then reusing them many times within
functions.

This (while not the desired intent of the author) will boost
performance when parsing input.

Signed-off-by: Enji Cooper <yaneurabeya@gmail.com>
4 years agoUse bools instead of ints values where possible
Enji Cooper [Fri, 27 Mar 2020 02:15:52 +0000 (19:15 -0700)]
Use bools instead of ints values where possible

This is being done to clarify logic and isn't being done for performance
reasons whatsoever, as bools are derived from ints.

Signed-off-by: Enji Cooper <yaneurabeya@gmail.com>
4 years agoRename all global variables to match the PEP8 spec
Enji Cooper [Fri, 27 Mar 2020 02:05:48 +0000 (19:05 -0700)]
Rename all global variables to match the PEP8 spec

Global variables should be in all caps, as opposed to lowercase.

While here, use named groups for `STRUCT_REF_RE` instead of numbered
groups to make the results and their indented tokens to parse more
intuitive to the end reader.

Signed-off-by: Enji Cooper <yaneurabeya@gmail.com>
4 years agoHandle file pointers with context suite patterns
Enji Cooper [Fri, 27 Mar 2020 00:37:09 +0000 (17:37 -0700)]
Handle file pointers with context suite patterns

This removes the need for manually calling the file pointer's `.close`
methods directly.

Signed-off-by: Enji Cooper <yaneurabeya@gmail.com>
4 years agoIterate over `tokens` with a for instead of while
Enji Cooper [Fri, 27 Mar 2020 03:42:40 +0000 (20:42 -0700)]
Iterate over `tokens` with a for instead of while

This simplifies the logic and avoids unnecessary copying/slicing of
array elements in `tokens`.

Signed-off-by: Enji Cooper <yaneurabeya@gmail.com>
4 years agoFix indentation for `RpcGenError`
Enji Cooper [Fri, 27 Mar 2020 00:28:09 +0000 (17:28 -0700)]
Fix indentation for `RpcGenError`

Indentation for the exception was double what it should have been. This
change normalizes the indentation to a consistent standard with the rest
of the file.

Fix minor flake8 issues while here corresponding to the minimum number
of needed blank lines around the class and its methods.

Signed-off-by: Enji Cooper <yaneurabeya@gmail.com>
4 years agoDon't override `file` built-in
Enji Cooper [Fri, 27 Mar 2020 00:21:25 +0000 (17:21 -0700)]
Don't override `file` built-in

Use `filep` instead of `file` to clarify the fact that `file` is a file
pointer object.

This mutes warnings on python 2.7 with `pylint`.

Signed-off-by: Enji Cooper <yaneurabeya@gmail.com>
4 years agoResolve variable name issues per PEP8
Enji Cooper [Fri, 27 Mar 2020 00:13:14 +0000 (17:13 -0700)]
Resolve variable name issues per PEP8

Move all logic under `if __name__ == "__main__"` to a `main(..)`
function.

The purpose of this is to not only address flake8/pylint reported issues
with variable names, but also to enable testing of the function in
isolation to ensure the logic acts as desired.

Signed-off-by: Enji Cooper <yaneurabeya@gmail.com>
4 years agoSort imports per PEP8
Enji Cooper [Thu, 26 Mar 2020 23:07:17 +0000 (16:07 -0700)]
Sort imports per PEP8

Signed-off-by: Enji Cooper <yaneurabeya@gmail.com>