Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package postsrsd for openSUSE:Factory checked in at 2022-08-17 18:17:02 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/postsrsd (Old) and /work/SRC/openSUSE:Factory/.postsrsd.new.1521 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "postsrsd" Wed Aug 17 18:17:02 2022 rev:4 rq:997504 version:1.12 Changes: -------- --- /work/SRC/openSUSE:Factory/postsrsd/postsrsd.changes 2021-04-27 21:34:42.735988736 +0200 +++ /work/SRC/openSUSE:Factory/.postsrsd.new.1521/postsrsd.changes 2022-08-17 18:23:21.503204382 +0200 @@ -1,0 +2,9 @@ +Wed Aug 17 08:37:45 UTC 2022 - Jan Engelhardt <jeng...@inai.de> + +- Update to release 1.12 + * Explicitly clear O_NONBLOCK to avoid inherited non-blocking + sockets on some operating systems + * Do not close all file descriptors up to _SC_MAX_OPEN, that + limit can be absurdly high and hang PostSRSd for minutes + +------------------------------------------------------------------- Old: ---- 1.11.tar.gz New: ---- 1.12.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ postsrsd.spec ++++++ --- /var/tmp/diff_new_pack.H96Hgw/_old 2022-08-17 18:23:21.895205195 +0200 +++ /var/tmp/diff_new_pack.H96Hgw/_new 2022-08-17 18:23:21.903205212 +0200 @@ -1,7 +1,7 @@ # # spec file for package postsrsd # -# Copyright (c) 2021 SUSE LLC +# Copyright (c) 2022 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -17,7 +17,7 @@ Name: postsrsd -Version: 1.11 +Version: 1.12 Release: 0 Summary: Sender Rewriting Support for postfix License: GPL-2.0-only ++++++ 1.11.tar.gz -> 1.12.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/postsrsd-1.11/.github/workflows/ci.yml new/postsrsd-1.12/.github/workflows/ci.yml --- old/postsrsd-1.11/.github/workflows/ci.yml 2021-03-21 20:23:39.000000000 +0100 +++ new/postsrsd-1.12/.github/workflows/ci.yml 2022-08-15 09:36:36.000000000 +0200 @@ -3,9 +3,9 @@ push: branches: - master - pull_request: - branches: - - master + pull_request: + branches: + - master jobs: build: runs-on: ubuntu-latest diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/postsrsd-1.11/.github/workflows/format.yml new/postsrsd-1.12/.github/workflows/format.yml --- old/postsrsd-1.11/.github/workflows/format.yml 2021-03-21 20:23:39.000000000 +0100 +++ new/postsrsd-1.12/.github/workflows/format.yml 2022-08-15 09:36:36.000000000 +0200 @@ -3,15 +3,15 @@ push: branches: - master - pull_request: - branches: - - master + pull_request: + branches: + - master jobs: clang-format: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - - uses: jidicula/clang-format-action@v3.1.0 + - uses: jidicula/clang-format-action@v4.6.2 with: clang-format-version: '11' diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/postsrsd-1.11/.gitignore new/postsrsd-1.12/.gitignore --- old/postsrsd-1.11/.gitignore 2021-03-21 20:23:39.000000000 +0100 +++ new/postsrsd-1.12/.gitignore 2022-08-15 09:36:36.000000000 +0200 @@ -1,4 +1,4 @@ -build +_build .project .cproject .settings diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/postsrsd-1.11/CMakeLists.txt new/postsrsd-1.12/CMakeLists.txt --- old/postsrsd-1.11/CMakeLists.txt 2021-03-21 20:23:39.000000000 +0100 +++ new/postsrsd-1.12/CMakeLists.txt 2022-08-15 09:36:36.000000000 +0200 @@ -1,6 +1,7 @@ cmake_minimum_required(VERSION 3.0) -project(postsrsd VERSION 1.11 LANGUAGES C) +project(postsrsd VERSION 1.12 LANGUAGES C) include(CheckIncludeFile) +include(CheckSymbolExists) include(CheckTypeSize) include(TestBigEndian) include(CTest) @@ -61,6 +62,20 @@ if(HAVE_SYS_TYPES_H) add_definitions(-DHAVE_SYS_TYPES_H) endif() +check_symbol_exists(close_range unistd.h HAVE_CLOSE_RANGE) +if(HAVE_CLOSE_RANGE) + add_definitions(-DHAVE_CLOSE_RANGE) +else() + set(saved_CMAKE_REQUIRED_DEFINITIONS "${CMAKE_REQUIRED_DEFINITIONS}") + list(APPEND CMAKE_REQUIRED_DEFINITIONS "-D_GNU_SOURCE") + check_symbol_exists(close_range unistd.h HAVE_CLOSE_RANGE_WITH_GNU_SOURCE) + set(CMAKE_REQUIRED_DEFINITIONS "${saved_CMAKE_REQUIRED_DEFINITIONS}") + unset(saved_CMAKE_REQUIRED_DEFINITIONS) + if(HAVE_CLOSE_RANGE_WITH_GNU_SOURCE) + add_definitions(-DHAVE_CLOSE_RANGE -D_GNU_SOURCE) + endif() +endif() + test_big_endian(WORDS_BIGENDIAN) if(WORDS_BIGENDIAN) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/postsrsd-1.11/makefile new/postsrsd-1.12/makefile --- old/postsrsd-1.11/makefile 2021-03-21 20:23:39.000000000 +0100 +++ new/postsrsd-1.12/makefile 2022-08-15 09:36:36.000000000 +0200 @@ -1,10 +1,10 @@ -all install test: build/Makefile - $(MAKE) -C build $@ +all install test: _build/Makefile + $(MAKE) -C _build $@ clean distclean: - rm -rf build + rm -rf _build -build/Makefile: CMakeLists.txt - mkdir -p build - cd build && cmake .. -DCMAKE_BUILD_TYPE=Release $(addprefix -DINIT_FLAVOR=,$(INIT_FLAVOR)) $(if $(CFLAGS),-DCMAKE_C_FLAGS="$(CFLAGS)",) $(addprefix -DCMAKE_C_COMPILER=,$(CC)) $(addprefix -DCMAKE_INSTALL_PREFIX=,$(PREFIX)) +_build/Makefile: CMakeLists.txt + mkdir -p _build + cd _build && cmake .. -DCMAKE_BUILD_TYPE=Release $(addprefix -DINIT_FLAVOR=,$(INIT_FLAVOR)) $(if $(CFLAGS),-DCMAKE_C_FLAGS="$(CFLAGS)",) $(addprefix -DCMAKE_C_COMPILER=,$(CC)) $(addprefix -DCMAKE_INSTALL_PREFIX=,$(PREFIX)) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/postsrsd-1.11/postsrsd.c new/postsrsd-1.12/postsrsd.c --- old/postsrsd-1.11/postsrsd.c 2021-03-21 20:23:39.000000000 +0100 +++ new/postsrsd-1.12/postsrsd.c 2022-08-15 09:36:36.000000000 +0200 @@ -334,7 +334,7 @@ size_t socket_count = 0, sc; int sockets[4] = {-1, -1, -1, -1}; handle_t handler[4] = {0, 0, 0, 0}; - int fd, maxfd; + int fd; excludes = (const char **)calloc(1, sizeof(char *)); tmp = strrchr(argv[0], '/'); @@ -493,14 +493,29 @@ return EXIT_FAILURE; } if (forward_service == NULL) + { forward_service = strdup("10001"); + } if (reverse_service == NULL) + { reverse_service = strdup("10002"); + } - /* Close all file descriptors (std ones will be closed later). */ - maxfd = sysconf(_SC_OPEN_MAX); - for (fd = 3; fd < maxfd; fd++) + /* Close all file descriptors (std ones will be closed later). + * Apparently, some processes spawning PostSRSd like to leak + * descriptors. Technically, this is not our responsibility, we are + * nice and clean up for other people. */ +#ifdef HAVE_CLOSE_RANGE + close_range(3, ~0U, 0); +#else + /* Fallback code. We try to close the first 1024 descriptors. The loop used + * to run until sysconf(_SC_OPEN_MAX), but that limit can be absurdly high + * (upwards of one billion on certain Docker containers), hanging PostSRSd + * for several minutes at startup. + */ + for (fd = 3; fd < 1024; ++fd) close(fd); +#endif /* The stuff we do first may not be possible from within chroot or without * privileges */ @@ -644,7 +659,7 @@ } while (TRUE) { - int conn; + int conn, flags; FILE *fp_read, *fp_write; char linebuf[1024], *line; char keybuf[1024], *key; @@ -667,6 +682,18 @@ conn = accept(fds[sc].fd, NULL, NULL); if (conn < 0) continue; + /* remove the nonblocking flag for OSes that bequeath it */ + flags = fcntl(conn, F_GETFL, 0); + if (flags < 0) + { + close(conn); + continue; + } + if (fcntl(conn, F_SETFL, flags & ~O_NONBLOCK) < 0) + { + close(conn); + continue; + } if (fork() == 0) { int i; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/postsrsd-1.11/run_postsrsd_tests.bats new/postsrsd-1.12/run_postsrsd_tests.bats --- old/postsrsd-1.11/run_postsrsd_tests.bats 2021-03-21 20:23:39.000000000 +0100 +++ new/postsrsd-1.12/run_postsrsd_tests.bats 2022-08-15 09:36:36.000000000 +0200 @@ -12,6 +12,20 @@ fi done fi +if [ ! -x "$FAKETIME" ] +then + if ! FAKETIME="$(which faketime)" + then + cat>&2 <<-EOF + cannot find faketime executable (looked in PATH=$PATH) + please install the faketime tool, or set the FAKETIME + environment variable if it is not in PATH. + + EOF + exit 1 + fi +fi + if [ ! -x "$POSTSRSD" ] then cat>&2 <<- EOF @@ -22,7 +36,6 @@ EOF exit 1 fi - LANG=C.UTF-8 @@ -38,7 +51,7 @@ echo 'tops3cr3t' > "$BATS_TMPDIR/postsrsd.secret" local faketime="$1" shift - faketime "${faketime}" ${POSTSRSD} -D -t1 -f 10001 -r 10002 -p "$BATS_TMPDIR/postsrsd.pid" -s "$BATS_TMPDIR/postsrsd.secret" -d example.com "$@" + ${FAKETIME} "${faketime}" ${POSTSRSD} -D -t1 -f 10001 -r 10002 -p "$BATS_TMPDIR/postsrsd.pid" -s "$BATS_TMPDIR/postsrsd.secret" -d example.com "$@" } stop_postsrsd()