diff options
Diffstat (limited to 'www-misc')
-rw-r--r-- | www-misc/Manifest.gz | bin | 2590 -> 2589 bytes | |||
-rw-r--r-- | www-misc/fcgiwrap/Manifest | 4 | ||||
-rw-r--r-- | www-misc/fcgiwrap/fcgiwrap-1.1.0_p20150419-r2.ebuild | 65 | ||||
-rw-r--r-- | www-misc/fcgiwrap/fcgiwrap-1.1.0_p20150419.ebuild | 2 | ||||
-rw-r--r-- | www-misc/fcgiwrap/files/fcgiwrap-1.1.0-cleanup.patch | 269 |
5 files changed, 338 insertions, 2 deletions
diff --git a/www-misc/Manifest.gz b/www-misc/Manifest.gz Binary files differindex 6e6bed579d37..d640cce0a522 100644 --- a/www-misc/Manifest.gz +++ b/www-misc/Manifest.gz diff --git a/www-misc/fcgiwrap/Manifest b/www-misc/fcgiwrap/Manifest index d06369aa12cf..04b8ade557ba 100644 --- a/www-misc/fcgiwrap/Manifest +++ b/www-misc/fcgiwrap/Manifest @@ -1,8 +1,10 @@ +AUX fcgiwrap-1.1.0-cleanup.patch 6672 BLAKE2B 045800fb7fd5dae4786a391b716162a276a800922b111647eafbb267ba51915d0f7a5158dbe02c0cf0bdc44add02d6df51e7293dbf650e773e5bea45d80ff150 SHA512 0a80a53aca22d6d9b12ccd6ab4d2be67bfcf30c85aa3b83433c065ee46160b93960fe988a4a63accbb58831e7fe0875fc594c5fce000d1ee10826f2e175a89c6 AUX fcgiwrap-1.1.0-kill.patch 745 BLAKE2B 68dca1e737916e2400257d29e86e17e5f41c108531ac39a8c36468c5a1fa0ea743f21b87f06e50c241603637446a4f87e8ba1c3aa20780f5015e303fd7b5699f SHA512 981623243b3cce51cb61127060a83454fc491a577ca2e3618d355f202bf2a0a3b7b1df73ebfbcade0491314527af10dc1b9ff711b298c59849eaa0575e05c1c3 AUX fcgiwrap-1.1.0-systemd.patch 788 BLAKE2B ecd35c1817344f15c8663bc4cc50afc9758fede57bc4c887172ffa0729b7466b3a3c6d3417f4c6d0ce723af6398e76f8abff1aa7e6b8ac8e5042ebc97ddb7b1d SHA512 a931b52f637ec5313d0ff91d61f736ac989362f92a6a7be8a855ad5e3c53fb8eb1a8383e5caeb423e4ee64062e87d4407b54666638bfba670cdcfe550b961724 AUX fcgiwrap-1.1.0-uninit-ipv6.patch 930 BLAKE2B 1d5d94e2a6d18dbf83c0dd1cb7c260b89bd3e82206f35d437c32b85e224ca9b17016b015af965dd29c45a29b353c9d4cf7c386e9df6c66235b99b47151f4859e SHA512 cef8fc278771aa8b13955d569c7484769e327449e5eb852d01d1f88f1eec73bc71fa0181280db84131e0d28c42076dd6a76a3914cbcc0947a26bbc8c0d862e5a DIST fcgiwrap-1.1.0.tar.gz 9924 BLAKE2B a96a87bfd1e4845be3a5018e5574edd40a800926ac531a041fae07f6810da509eecf97a19b2debe0ea318f2968f30184f4f6c1c02495777492d32826a0f759a1 SHA512 b8d35762d1d3c94a67602290b0092f0c38cffbbcd3dbc16597abf8b92172909b04450c238de2e430e841a17dd47fdd48d6a001f77539966980ef1af61e447ddc DIST fcgiwrap-1.1.0_p20150419.gh.tar.gz 10833 BLAKE2B 3820d2aee99a225656c9b3621f5ccf936b4909e74331a6332925bfbda38e8795339d943768aff4c967381bd52f349f445bcce335e3f94f7fb67ed15e5844a9ad SHA512 87613dcaf617107bb179e5f1c50878f6378fcfcc53237a262881cc8e18a7d8c011215f1642d6d00797f322e08118ff9ed4a1da9fa5d09006f3ffbe20547e4f08 EBUILD fcgiwrap-1.1.0-r2.ebuild 1203 BLAKE2B f484e95935ba1b82cb2048235cb150559aab3a6ec70fb223b122759c74044508f4309192c475485cd0efb94cb77dc6774c5460fe58008d65dbb023dab4e6a167 SHA512 ffdf5b0ac8a10d92674e7546be7872d9c4fb6b210ff28b8cf381a83b58e032fa2480b2981d956bb34b35ddaf1290c700dbbda4490f0d6ed7ad9351b2f6f5ab77 -EBUILD fcgiwrap-1.1.0_p20150419.ebuild 1544 BLAKE2B 84743fb7526a92c1a437eb3857534d36f506c296e9e32f98e6f26d70122441162939d61a574852ebfa8627ab7d02b97d1a13b3617db6aed575667e0f29cae9f3 SHA512 29ba7a6b121bc229910d316c2167243c96df79f7dd790d7bdbd28bc74a16bba2b268809f22a0ca18613cfad609183dd29480a1806b1366157cfeca28ccf4d688 +EBUILD fcgiwrap-1.1.0_p20150419-r2.ebuild 1585 BLAKE2B 2f6f27c6076bebebfe0eaf2d57f6ef6cce9079d743df543ef14bd2bc0e293148df20f6befabe079ca958924be27697bd1db1abe73092553b7839b6702cbd1d5e SHA512 2fdbce7a3f5c0ceee1443cc1ead4b4f0a08c0a2fc6ca83ec81ca5c2facf0a856ec8997c6f3cf0bc510106d29aaba0d10b6b4f54624829a7d27c4ac167dad1d70 +EBUILD fcgiwrap-1.1.0_p20150419.ebuild 1542 BLAKE2B 1a16fd8988d8469ed7f87e30385f26d7b9b64d3d725f99b47674029a100b6cf1f6b1215efa716997edd41675881f24ab8f85d3180f7308086de081c6516a9221 SHA512 008819bd3757dcd898468275cf03fcf2bf49252acae125c673a7baf8be63dca991f7eb35975817c4a18e48c8774fd24fe42de1598b6ba7c3538581146e3d8e9f MISC metadata.xml 459 BLAKE2B b5e849549c0e7318e9e1fc39cc89358b5372f64a4c300c343a07d928f3eee4658593720146132cab9dbf9caf5e8aaed80c4d71a64eba449e7108bf048c68268f SHA512 fbdb6a797983a71a11a92cbef40df7745b1a2e96c102c1f41562a861547918bf290b175ec7d41d186a9972375f571afe5e24a7b99fdc086d58b9c892d68fc9b1 diff --git a/www-misc/fcgiwrap/fcgiwrap-1.1.0_p20150419-r2.ebuild b/www-misc/fcgiwrap/fcgiwrap-1.1.0_p20150419-r2.ebuild new file mode 100644 index 000000000000..9aa4dce6e7a0 --- /dev/null +++ b/www-misc/fcgiwrap/fcgiwrap-1.1.0_p20150419-r2.ebuild @@ -0,0 +1,65 @@ +# Copyright 1999-2025 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +inherit autotools systemd toolchain-funcs + +DESCRIPTION="Simple FastCGI wrapper for CGI scripts (CGI support for nginx)" +HOMEPAGE="https://github.com/gnosek/fcgiwrap" +if [[ ${PV} == *_p* ]] ; then + FCGIWRAP_COMMIT="99c942c90063c73734e56bacaa65f947772d9186" + SRC_URI="https://github.com/gnosek/fcgiwrap/archive/${FCGIWRAP_COMMIT}.tar.gz -> ${P}.gh.tar.gz" + S="${WORKDIR}"/${PN}-${FCGIWRAP_COMMIT} +else + # https://github.com/gnosek/fcgiwrap/issues/31 + SRC_URI="https://github.com/gnosek/${PN}/archive/refs/tags/${PV}.tar.gz -> ${P}.tar.gz" +fi + +LICENSE="BSD" +SLOT="0" +KEYWORDS="~amd64 ~arm ~x86" +IUSE="systemd" + +RDEPEND=" + dev-libs/fcgi + systemd? ( sys-apps/systemd:= ) +" +DEPEND="${RDEPEND}" +BDEPEND="virtual/pkgconfig" + +DOCS=( README.rst ) + +PATCHES=( + "${FILESDIR}"/${PN}-1.1.0-kill.patch + "${FILESDIR}"/${PN}-1.1.0-systemd.patch + "${FILESDIR}"/${PN}-1.1.0-uninit-ipv6.patch + "${FILESDIR}"/${PN}-1.1.0-cleanup.patch +) + +src_prepare() { + default + + sed -e "s/-Werror//" \ + -i configure.ac || die "sed failed" + sed -e '/man8dir = $(DESTDIR)/s/@prefix@//' \ + -i Makefile.in || die "sed failed" + + tc-export CC + + # Fix systemd units for Gentoo + sed -i -e '/User/d' systemd/fcgiwrap.service || die + sed -i -e '/Group/d' systemd/fcgiwrap.service || die + + eautoreconf +} + +src_configure() { + econf \ + $(use_with systemd) \ + --with-systemdsystemunitdir="$(systemd_get_systemunitdir)" +} + +pkg_postinst() { + einfo "You may want to install www-servers/spawn-fcgi to use with fcgiwrap." +} diff --git a/www-misc/fcgiwrap/fcgiwrap-1.1.0_p20150419.ebuild b/www-misc/fcgiwrap/fcgiwrap-1.1.0_p20150419.ebuild index d7ecbe02f3e4..ec5f9c97a2d4 100644 --- a/www-misc/fcgiwrap/fcgiwrap-1.1.0_p20150419.ebuild +++ b/www-misc/fcgiwrap/fcgiwrap-1.1.0_p20150419.ebuild @@ -18,7 +18,7 @@ fi LICENSE="BSD" SLOT="0" -KEYWORDS="~amd64 ~arm ~x86" +KEYWORDS="amd64 ~arm x86" IUSE="systemd" RDEPEND=" diff --git a/www-misc/fcgiwrap/files/fcgiwrap-1.1.0-cleanup.patch b/www-misc/fcgiwrap/files/fcgiwrap-1.1.0-cleanup.patch new file mode 100644 index 000000000000..3e5179aee4cc --- /dev/null +++ b/www-misc/fcgiwrap/files/fcgiwrap-1.1.0-cleanup.patch @@ -0,0 +1,269 @@ +https://github.com/gnosek/fcgiwrap/pull/60 + +From 93ce8e8489bda4a7ebe5161020c83a68f744481f Mon Sep 17 00:00:00 2001 +From: flu0r1ne <flu0r1ne@flu0r1ne.net> +Date: Sat, 9 Sep 2023 22:56:05 -0500 +Subject: [PATCH 1/4] Fix implicit fallthrough false positive, noreturn + +With warnings and pedantic mode enabled, `gcc (GCC) 13.2.1` returns +an implicit fall through warning. This can be fixed by annotating +the error function with NORETURN. +--- + fcgiwrap.c | 8 +++++++- + 1 file changed, 7 insertions(+), 1 deletion(-) + +diff --git a/fcgiwrap.c b/fcgiwrap.c +index b44d8aa..8310284 100644 +--- a/fcgiwrap.c ++++ b/fcgiwrap.c +@@ -56,6 +56,12 @@ + #define UNIX_PATH_MAX 108 + #endif + ++#if defined(__GNUC__) || defined(__clang__) ++# define NORETURN __attribute__((__noreturn__)) ++#else ++# define NORETURN ++#endif ++ + extern char **environ; + static char * const * inherited_environ; + static const char **allowed_programs; +@@ -500,7 +506,7 @@ static bool is_allowed_program(const char *program) { + return false; + } + +-static void cgi_error(const char *message, const char *reason, const char *filename) ++static void NORETURN cgi_error(const char *message, const char *reason, const char *filename) + { + printf("Status: %s\r\nContent-Type: text/plain\r\n\r\n%s\r\n", + message, message); + +From 8b8aae2ac99bc91a72a32ca2040302f785e10e2b Mon Sep 17 00:00:00 2001 +From: flu0r1ne <flu0r1ne@flu0r1ne.net> +Date: Sun, 10 Sep 2023 03:50:27 -0500 +Subject: [PATCH 2/4] close() always results in a duplicate call + +Remove close as it always results in a duplicated call, simplify logic +--- + fcgiwrap.c | 27 ++++++++++++++++----------- + 1 file changed, 16 insertions(+), 11 deletions(-) + +diff --git a/fcgiwrap.c b/fcgiwrap.c +index 8310284..cfb7797 100644 +--- a/fcgiwrap.c ++++ b/fcgiwrap.c +@@ -62,6 +62,8 @@ + # define NORETURN + #endif + ++#define FCGI_FD 0 ++ + extern char **environ; + static char * const * inherited_environ; + static const char **allowed_programs; +@@ -706,8 +708,8 @@ static int listen_on_fd(int fd) { + perror("Failed to enable SO_REUSEADDR"); + return -1; + } +- if (dup2(fd, 0) < 0) { +- perror("Failed to move socket to fd 0"); ++ if (dup2(fd, FCGI_FD) < 0) { ++ fprintf(stderr, "Failed to move socket to fd %d", FCGI_FD); + return -1; + } + if (close(fd) < 0) { +@@ -809,7 +811,7 @@ int main(int argc, char **argv) + { + int nchildren = 1; + char *socket_url = NULL; +- int fd = 0; ++ int fd = FCGI_FD; + int c; + + while ((c = getopt(argc, argv, "c:hfs:p:")) != -1) { +@@ -860,6 +862,10 @@ int main(int argc, char **argv) + + #ifdef HAVE_SYSTEMD + if (sd_listen_fds(true) > 0) { ++ if(socket_url) { ++ perror("warning: a systemd socket has been provding, ignoring '-s'\n"); ++ } ++ + /* systemd woke us up. we should never see more than one FD passed to us. */ + if (listen_on_fd(SD_LISTEN_FDS_START) < 0) { + return 1; +@@ -876,16 +882,15 @@ int main(int argc, char **argv) + prefork(nchildren); + fcgiwrap_main(); + +- if (fd) { +- const char *p = socket_url; +- close(fd); ++ close(FCGI_FD); + +- if (socket_url) { +- if (!strncmp(p, "unix:", sizeof("unix:") - 1)) { +- p += sizeof("unix:") - 1; +- unlink(p); +- } ++ if (fd && socket_url) { // fd > 0 indicates a socket was setup by us ++ const char *p = socket_url; ++ if (!strncmp(p, "unix:", sizeof("unix:") - 1)) { ++ p += sizeof("unix:") - 1; ++ unlink(p); + } + } ++ + return 0; + } + +From b4f2469369960fb914c1d1eb4942feebf648835a Mon Sep 17 00:00:00 2001 +From: flu0r1ne <flu0r1ne@flu0r1ne.net> +Date: Sun, 10 Sep 2023 04:14:17 -0500 +Subject: [PATCH 3/4] Add better error handling for socket setup + +--- + fcgiwrap.c | 18 +++++++++++++++--- + 1 file changed, 15 insertions(+), 3 deletions(-) + +diff --git a/fcgiwrap.c b/fcgiwrap.c +index cfb7797..5b8af47 100644 +--- a/fcgiwrap.c ++++ b/fcgiwrap.c +@@ -793,18 +793,30 @@ static int setup_socket(char *url) { + fd = socket(sa.sa.sa_family, SOCK_STREAM, 0); + if (fd < 0) { + perror("Failed to create socket"); +- return -1; ++ goto cleanup_socket; + } + if (bind(fd, &sa.sa, sockaddr_size) < 0) { + perror("Failed to bind"); +- return -1; ++ goto cleanup_fd; + } + + if (listen_on_fd(fd) < 0) { +- return -1; ++ goto cleanup_fd; + } + + return fd; ++ ++cleanup_fd: ++ ++ close(fd); ++ ++cleanup_socket: ++ ++ if(sa.sa.sa_family == AF_UNIX) { ++ unlink(sa.sa_un.sun_path); ++ } ++ ++ return -1; + } + + int main(int argc, char **argv) + +From 2870d2729a3930988f0041e2d78fec672e69afac Mon Sep 17 00:00:00 2001 +From: flu0r1ne <flu0r1ne@flu0r1ne.net> +Date: Sun, 10 Sep 2023 04:36:16 -0500 +Subject: [PATCH 4/4] Kill all child processes on parent SIGTERM + +When attached to a terminal, a SIGINT signal is sent to the parent +and all children, instructing them to exit. In some environments including +docker, only the parent receives the SIGTERM and is responsible for +propagating it to the children. This patch kills all child processes +when the parent receives a SIGTERM or a SIGINT. +--- + fcgiwrap.c | 38 ++++++++++++++++++++++++++++---------- + 1 file changed, 28 insertions(+), 10 deletions(-) + +diff --git a/fcgiwrap.c b/fcgiwrap.c +index 5b8af47..123d279 100644 +--- a/fcgiwrap.c ++++ b/fcgiwrap.c +@@ -62,6 +62,12 @@ + # define NORETURN + #endif + ++#if defined(__GNUC__) ++# define UNUSED __attribute__((__unused__)) ++#else ++# define UNUSED ++#endif ++ + #define FCGI_FD 0 + + extern char **environ; +@@ -646,6 +652,8 @@ static void fcgiwrap_main(void) + while (FCGI_Accept() >= 0 && !sigint_received) { + handle_fcgi_request(); + } ++ ++ close(FCGI_FD); + } + + static volatile sig_atomic_t nrunning; +@@ -665,21 +673,26 @@ static void sigchld_handler(int dummy) + } + } + ++static volatile sig_atomic_t stop_requested; ++ ++static void stop_request_handler(int UNUSED signum) { ++ stop_requested = 1; ++} ++ + static void prefork(int nchildren) + { + int startup = 1; + +- if (nchildren == 1) { +- return; +- } +- + signal(SIGCHLD, sigchld_handler); ++ signal(SIGINT, stop_request_handler); ++ signal(SIGTERM, stop_request_handler); + +- while (1) { ++ while (!stop_requested) { + while (nrunning < nchildren) { + pid_t pid = fork(); + if (pid == 0) { +- return; ++ fcgiwrap_main(); ++ exit(0); + } else if (pid != -1) { + nrunning++; + } else { +@@ -695,6 +708,10 @@ static void prefork(int nchildren) + startup = 0; + pause(); + } ++ ++ if(killpg(0, SIGTERM) != 0) { ++ fprintf(stderr, "killpg() encountered an error, child processes may have to be killed"); ++ } + } + + static int listen_on_fd(int fd) { +@@ -891,10 +908,11 @@ int main(int argc, char **argv) + } + } + +- prefork(nchildren); +- fcgiwrap_main(); +- +- close(FCGI_FD); ++ if(nchildren > 1) { ++ prefork(nchildren); ++ } else { ++ fcgiwrap_main(); ++ } + + if (fd && socket_url) { // fd > 0 indicates a socket was setup by us + const char *p = socket_url; + |