diff -Nru gpgme1.0-1.16.0/debian/changelog gpgme1.0-1.16.0/debian/changelog --- gpgme1.0-1.16.0/debian/changelog 2022-03-31 11:59:19.000000000 +0000 +++ gpgme1.0-1.16.0/debian/changelog 2023-09-11 15:02:16.000000000 +0000 @@ -1,3 +1,16 @@ +gpgme1.0 (1.16.0-1.2ubuntu4.1+lp1) jammy; urgency=medium + + * Cherry-pick from upstream: + - posix: Use poll instead, when available, removing use of select. + + -- Colin Watson Mon, 11 Sep 2023 16:02:16 +0100 + +gpgme1.0 (1.16.0-1.2ubuntu4.1) jammy; urgency=medium + + * avoid -unknown suffix (Closes: #1004742, LP: #1991606) + + -- Benjamin Drung Thu, 29 Jun 2023 18:37:08 +0200 + gpgme1.0 (1.16.0-1.2ubuntu4) jammy; urgency=medium * d/patches: diff -Nru gpgme1.0-1.16.0/debian/patches/0001-avoid-identifying-as-beta.patch gpgme1.0-1.16.0/debian/patches/0001-avoid-identifying-as-beta.patch --- gpgme1.0-1.16.0/debian/patches/0001-avoid-identifying-as-beta.patch 2021-11-24 02:23:52.000000000 +0000 +++ gpgme1.0-1.16.0/debian/patches/0001-avoid-identifying-as-beta.patch 1970-01-01 00:00:00.000000000 +0000 @@ -1,25 +0,0 @@ -From: Daniel Kahn Gillmor -Date: Thu, 11 Jun 2015 18:26:16 -0400 -Subject: avoid identifying as beta - -If we build from git-buildpackage using autoreconf, it comes out -looking like a beta because we're not on a git tag. - -This patch avoids that situation. ---- - autogen.sh | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/autogen.sh b/autogen.sh -index 9b36158..5cfc244 100755 ---- a/autogen.sh -+++ b/autogen.sh -@@ -249,7 +249,7 @@ if [ "$myhost" = "find-version" ]; then - fi - - beta=no -- if [ -e .git ]; then -+ if false; then - ingit=yes - tmp=$(git describe --match "${matchstr1}" --long 2>/dev/null) - tmp=$(echo "$tmp" | sed s/^"$package"//) diff -Nru gpgme1.0-1.16.0/debian/patches/0001-Remove-upstream-git-fanciness.patch gpgme1.0-1.16.0/debian/patches/0001-Remove-upstream-git-fanciness.patch --- gpgme1.0-1.16.0/debian/patches/0001-Remove-upstream-git-fanciness.patch 1970-01-01 00:00:00.000000000 +0000 +++ gpgme1.0-1.16.0/debian/patches/0001-Remove-upstream-git-fanciness.patch 2023-06-29 16:34:28.000000000 +0000 @@ -0,0 +1,105 @@ +From: Daniel Kahn Gillmor +Date: Thu, 11 Jun 2015 18:26:16 -0400 +Subject: Remove upstream git fanciness + +Debian needs to be able to build libgpg-error while using git for +tracking the debian packaging itself. Debian also wants to autoreconf +this stuff. However, Debian does *not* need to conform exactly to +upstream's git configurations. + +This avoids mistakes like accidentally identifying running code as a +beta. + +This is the same approach taken in debian's libgpg-error packaging +since 2017. + +Forwarded: not-needed +--- + autogen.sh | 67 ++++---------------------------------------------------------- + 1 file changed, 4 insertions(+), 63 deletions(-) + +diff --git a/autogen.sh b/autogen.sh +index 9b36158..5dfca0e 100755 +--- a/autogen.sh ++++ b/autogen.sh +@@ -249,27 +249,10 @@ if [ "$myhost" = "find-version" ]; then + fi + + beta=no +- if [ -e .git ]; then +- ingit=yes +- tmp=$(git describe --match "${matchstr1}" --long 2>/dev/null) +- tmp=$(echo "$tmp" | sed s/^"$package"//) +- if [ -n "$tmp" ]; then +- tmp=$(echo "$tmp" | sed s/^"$package"// \ +- | awk -F- '$3!=0 && $3 !~ /^beta/ {print"-beta"$3}') +- else +- tmp=$(git describe --match "${matchstr2}" --long 2>/dev/null \ +- | awk -F- '$4!=0{print"-beta"$4}') +- fi +- [ -n "$tmp" ] && beta=yes +- rev=$(git rev-parse --short HEAD | tr -d '\n\r') +- rvd=$((0x$(echo ${rev} | dd bs=1 count=4 2>/dev/null))) +- else +- ingit=no +- beta=yes +- tmp="-unknown" +- rev="0000000" +- rvd="0" +- fi ++ ingit=no ++ tmp="" ++ rvd="$(wc -l < debian/changelog)" ++ rev="$(printf %07x $rvd)" + + echo "$package-$vers$tmp:$beta:$ingit:$vers$tmp:$vers:$tmp:$rev:$rvd:" + exit 0 +@@ -452,48 +435,6 @@ EOF + die_p + fi + +-# Check the git setup. +-if [ -d .git ]; then +- CP="cp -p" +- # If we have a GNU cp we can add -v +- if cp --version >/dev/null 2>/dev/null; then +- [ -z "${SILENT}" ] && CP="$CP -v" +- fi +- if [ -f .git/hooks/pre-commit.sample -a ! -f .git/hooks/pre-commit ] ; then +- [ -z "${SILENT}" ] && cat < +Date: Thu, 25 Nov 2021 11:13:17 +0900 +Subject: [PATCH] posix: Use poll instead, when available, removing use of + select. + +* configure.ac (HAVE_POLL_H): Add the check. +* src/ath.c [!HAVE_POLL_H] (ath_select): Enable conditionally. +* src/posix-io.c [HAVE_POLL_H] (_gpgme_io_select_poll): Use poll. +* tests/gpg/t-cancel.c [HAVE_POLL_H] (do_select): Use poll. +* tests/gpg/t-eventloop.c [HAVE_POLL_H] (do_select): Use poll. + +-- + +GnuPG-bug-id: 2385 +Signed-off-by: NIIBE Yutaka +--- + configure.ac | 2 +- + src/ath.c | 15 +++-- + src/ath.h | 13 +++-- + src/posix-io.c | 125 +++++++++++++++++++++++++++++++++++++++- + tests/gpg/t-cancel.c | 67 ++++++++++++++++++++- + tests/gpg/t-eventloop.c | 63 +++++++++++++++++++- + 6 files changed, 269 insertions(+), 16 deletions(-) + +Origin: upstream, https://git.gnupg.org/cgi-bin/gitweb.cgi?p=gpgme.git;a=commitdiff;h=8148237cb4ae20755c06a44d71761c7030973c3d + +Index: b/configure.ac +=================================================================== +--- a/configure.ac ++++ b/configure.ac +@@ -542,7 +542,7 @@ + + # Checks for header files. + AC_CHECK_HEADERS_ONCE([locale.h sys/select.h sys/uio.h argp.h stdint.h +- unistd.h sys/time.h sys/types.h sys/stat.h]) ++ unistd.h poll.h sys/time.h sys/types.h sys/stat.h]) + + + # Type checks. +Index: b/src/ath.c +=================================================================== +--- a/src/ath.c ++++ b/src/ath.c +@@ -26,11 +26,15 @@ + #ifdef HAVE_UNISTD_H + # include + #endif +-#ifdef HAVE_SYS_SELECT_H +-# include ++#ifdef HAVE_POLL_H ++# include + #else +-# ifdef HAVE_SYS_TIME_H +-# include ++# ifdef HAVE_SYS_SELECT_H ++# include ++# else ++# ifdef HAVE_SYS_TIME_H ++# include ++# endif + # endif + #endif + #ifdef HAVE_SYS_TYPES_H +@@ -89,6 +93,7 @@ + } + + ++#if !defined(HAVE_POLL_H) + gpgme_ssize_t + ath_select (int nfd, fd_set *rset, fd_set *wset, fd_set *eset, + struct timeval *timeout) +@@ -99,7 +104,7 @@ + return select (nfd, rset, wset, eset, timeout); + #endif + } +- ++#endif + + gpgme_ssize_t + ath_waitpid (pid_t pid, int *status, int options) +Index: b/src/ath.h +=================================================================== +--- a/src/ath.h ++++ b/src/ath.h +@@ -32,12 +32,15 @@ + # include + + #else /*!HAVE_W32_SYSTEM*/ +- +-# ifdef HAVE_SYS_SELECT_H +-# include ++# ifdef HAVE_POLL_H ++# include + # else +-# ifdef HAVE_SYS_TIME_H +-# include ++# ifdef HAVE_SYS_SELECT_H ++# include ++# else ++# ifdef HAVE_SYS_TIME_H ++# include ++# endif + # endif + # endif + # ifdef HAVE_SYS_TYPES_H +Index: b/src/posix-io.c +=================================================================== +--- a/src/posix-io.c ++++ b/src/posix-io.c +@@ -691,8 +691,119 @@ + + /* Select on the list of fds. Returns: -1 = error, 0 = timeout or + nothing to select, > 0 = number of signaled fds. */ +-int +-_gpgme_io_select (struct io_select_fd_s *fds, size_t nfds, int nonblock) ++#ifdef HAVE_POLL_H ++static int ++_gpgme_io_select_poll (struct io_select_fd_s *fds, size_t nfds, int nonblock) ++{ ++ struct pollfd *poll_fds = NULL; ++ nfds_t poll_nfds; ++ /* Use a 1s timeout. */ ++ int timeout = 1000; ++ unsigned int i; ++ int any; ++ int count; ++ void *dbg_help = NULL; ++ TRACE_BEG (DEBUG_SYSIO, "_gpgme_io_select", NULL, ++ "nfds=%zu, nonblock=%u", nfds, nonblock); ++ ++ ++ if (nonblock) ++ timeout = 0; ++ ++ poll_fds = malloc (sizeof (*poll_fds)*nfds); ++ if (!poll_fds) ++ return -1; ++ ++ poll_nfds = 0; ++ ++ TRACE_SEQ (dbg_help, "poll on [ "); ++ ++ any = 0; ++ for (i = 0; i < nfds; i++) ++ { ++ if (fds[i].fd == -1) ++ continue; ++ if (fds[i].for_read || fds[i].for_write) ++ { ++ poll_fds[poll_nfds].fd = fds[i].fd; ++ poll_fds[poll_nfds].events = 0; ++ poll_fds[poll_nfds].revents = 0; ++ if (fds[i].for_read) ++ { ++ poll_fds[poll_nfds].events |= POLLIN; ++ TRACE_ADD1 (dbg_help, "r=%d ", fds[i].fd); ++ } ++ if (fds[i].for_write) ++ { ++ poll_fds[poll_nfds].events |= POLLOUT; ++ TRACE_ADD1 (dbg_help, "w=%d ", fds[i].fd); ++ } ++ poll_nfds++; ++ any = 1; ++ } ++ fds[i].signaled = 0; ++ } ++ TRACE_END (dbg_help, "]"); ++ if (!any) ++ { ++ free (poll_fds); ++ return TRACE_SYSRES (0); ++ } ++ ++ do ++ count = poll (poll_fds, poll_nfds, timeout); ++ while (count < 0 && (errno == EINTR || errno == EAGAIN)); ++ if (count < 0) ++ { ++ int save_errno = errno; ++ free (poll_fds); ++ errno = save_errno; ++ return TRACE_SYSRES (-1); ++ } ++ ++ TRACE_SEQ (dbg_help, "poll OK [ "); ++ if (TRACE_ENABLED (dbg_help)) ++ { ++ poll_nfds = 0; ++ for (i = 0; i < nfds; i++) ++ { ++ if (fds[i].fd == -1) ++ continue; ++ if ((poll_fds[poll_nfds].revents & (POLLIN|POLLHUP))) ++ TRACE_ADD1 (dbg_help, "r=%d ", i); ++ if ((poll_fds[poll_nfds].revents & POLLOUT)) ++ TRACE_ADD1 (dbg_help, "w=%d ", i); ++ poll_nfds++; ++ } ++ TRACE_END (dbg_help, "]"); ++ } ++ ++ poll_nfds = 0; ++ for (i = 0; i < nfds; i++) ++ { ++ if (fds[i].fd == -1) ++ continue; ++ if (fds[i].for_read || fds[i].for_write) ++ { ++ short events_to_be_checked = 0; ++ ++ if (fds[i].for_read) ++ events_to_be_checked |= (POLLIN|POLLHUP); ++ if (fds[i].for_write) ++ events_to_be_checked |= POLLOUT; ++ if ((poll_fds[poll_nfds].revents & events_to_be_checked)) ++ fds[i].signaled = 1; ++ ++ poll_nfds++; ++ } ++ } ++ ++ free (poll_fds); ++ return TRACE_SYSRES (count); ++} ++#else ++static int ++_gpgme_io_select_select (struct io_select_fd_s *fds, size_t nfds, int nonblock) + { + fd_set readfds; + fd_set writefds; +@@ -802,7 +913,17 @@ + } + return TRACE_SYSRES (count); + } ++#endif + ++int ++_gpgme_io_select (struct io_select_fd_s *fds, size_t nfds, int nonblock) ++{ ++#ifdef HAVE_POLL_H ++ return _gpgme_io_select_poll (fds, nfds, nonblock); ++#else ++ return _gpgme_io_select_select (fds, nfds, nonblock); ++#endif ++} + + int + _gpgme_io_recvmsg (int fd, struct msghdr *msg, int flags) +Index: b/tests/gpg/t-cancel.c +=================================================================== +--- a/tests/gpg/t-cancel.c ++++ b/tests/gpg/t-cancel.c +@@ -38,8 +38,16 @@ + #include + #include + #include +-#ifdef HAVE_SYS_SELECT_H +-# include ++#ifdef HAVE_POLL_H ++# include ++#else ++# ifdef HAVE_SYS_SELECT_H ++# include ++# else ++# ifdef HAVE_SYS_TIME_H ++# include ++# endif ++# endif + #endif + + #include +@@ -116,6 +124,60 @@ + } + + ++#ifdef HAVE_POLL_H ++static int ++do_select (void) ++{ ++ struct pollfd poll_fds[FDLIST_MAX]; ++ nfds_t poll_nfds; ++ int i, n; ++ int any = 0; ++ ++ pthread_mutex_lock (&lock); ++ poll_nfds = 0; ++ for (i = 0; i < FDLIST_MAX; i++) ++ if (fdlist[i].fd != -1) ++ { ++ poll_fds[poll_nfds].fd = fdlist[i].fd; ++ poll_fds[poll_nfds].events = 0; ++ poll_fds[poll_nfds].revents = 0; ++ if (fdlist[i].dir) ++ poll_fds[poll_nfds].events |= POLLIN; ++ else ++ poll_fds[poll_nfds].events |= POLLOUT; ++ poll_nfds++; ++ } ++ pthread_mutex_unlock (&lock); ++ ++ do ++ { ++ n = poll (poll_fds, poll_nfds, 1000); ++ } ++ while (n < 0 && (errno == EINTR || errno == EAGAIN)); ++ ++ if (n < 0) ++ return n; /* Error or timeout. */ ++ ++ pthread_mutex_lock (&lock); ++ poll_nfds = 0; ++ for (i = 0; i < FDLIST_MAX && n; i++) ++ { ++ if (fdlist[i].fd != -1) ++ { ++ if ((poll_fds[poll_nfds++].revents ++ & (fdlist[i].dir ? (POLLIN|POLLHUP) : POLLOUT))) ++ { ++ assert (n); ++ n--; ++ any = 1; ++ (*fdlist[i].fnc) (fdlist[i].fnc_data, fdlist[i].fd); ++ } ++ } ++ } ++ pthread_mutex_unlock (&lock); ++ return any; ++} ++#else + static int + do_select (void) + { +@@ -162,6 +224,7 @@ + pthread_mutex_unlock (&lock); + return any; + } ++#endif + + static int + my_wait (void) +Index: b/tests/gpg/t-eventloop.c +=================================================================== +--- a/tests/gpg/t-eventloop.c ++++ b/tests/gpg/t-eventloop.c +@@ -31,7 +31,17 @@ + #include + #include + #include +-#include ++#ifdef HAVE_POLL_H ++# include ++#else ++# ifdef HAVE_SYS_SELECT_H ++# include ++# else ++# ifdef HAVE_SYS_TIME_H ++# include ++# endif ++# endif ++#endif + + #include + +@@ -104,6 +114,56 @@ + } + + ++#ifdef HAVE_POLL_H ++int ++do_select (void) ++{ ++ struct pollfd poll_fds[FDLIST_MAX]; ++ nfds_t poll_nfds; ++ int i, n; ++ int any = 0; ++ ++ poll_nfds = 0; ++ for (i = 0; i < FDLIST_MAX; i++) ++ if (fdlist[i].fd != -1) ++ { ++ poll_fds[poll_nfds].fd = fdlist[i].fd; ++ poll_fds[poll_nfds].events = 0; ++ poll_fds[poll_nfds].revents = 0; ++ if (fdlist[i].dir) ++ poll_fds[poll_nfds].events |= POLLIN; ++ else ++ poll_fds[poll_nfds].events |= POLLOUT; ++ poll_nfds++; ++ } ++ ++ do ++ { ++ n = poll (poll_fds, poll_nfds, 1000); ++ } ++ while (n < 0 && (errno == EINTR || errno == EAGAIN)); ++ ++ if (n < 0) ++ return n; /* Error or timeout. */ ++ ++ poll_nfds = 0; ++ for (i = 0; i < FDLIST_MAX && n; i++) ++ { ++ if (fdlist[i].fd != -1) ++ { ++ if ((poll_fds[poll_nfds++].revents ++ & (fdlist[i].dir ? (POLLIN|POLLHUP) : POLLOUT))) ++ { ++ assert (n); ++ n--; ++ any = 1; ++ (*fdlist[i].fnc) (fdlist[i].fnc_data, fdlist[i].fd); ++ } ++ } ++ } ++ return any; ++} ++#else + int + do_select (void) + { +@@ -146,6 +206,7 @@ + } + return any; + } ++#endif + + int + my_wait (void) diff -Nru gpgme1.0-1.16.0/debian/patches/series gpgme1.0-1.16.0/debian/patches/series --- gpgme1.0-1.16.0/debian/patches/series 2022-03-31 11:59:19.000000000 +0000 +++ gpgme1.0-1.16.0/debian/patches/series 2023-09-11 15:01:56.000000000 +0000 @@ -1,4 +1,4 @@ -0001-avoid-identifying-as-beta.patch +0001-Remove-upstream-git-fanciness.patch 0004-drop-python2-support.patch 0006-Ship-python-examples-with-python3-in-shebang-line.patch 0004-core-Fix-use-after-free-issue-in-test.patch @@ -6,3 +6,4 @@ 0006-Avoid-the-hardcoded-list-of-Python-versions.patch 0001-core-Support-closefrom-also-for-glibc.patch 0007-lang-python-tests-Fix-FTBFS-caused-by-missing-PYTHON.patch +0008-poll.patch