update to 1.20.0

sync with mainline spec file
order configure options alphabetically for easier comparinggit
add --with-compat option (rhbz#1834452)
add patch to fix PIDFile race condition (rhbz#1869026)
use pcre2 instead of pcre (rhbz#1938984)
add Wants=network-online.target to systemd unit (rhbz#1943779)
This commit is contained in:
Felix Kaechele 2021-04-20 21:59:53 -04:00
parent cdbbf72f9e
commit d1fd6c2b93
9 changed files with 209 additions and 123 deletions

View File

@ -0,0 +1,31 @@
From 00cab63102084b89de0a3494a1d023c4b1d4982b Mon Sep 17 00:00:00 2001
From: Felix Kaechele <felix@kaechele.ca>
Date: Sun, 7 Jun 2020 12:14:02 -0400
Subject: [PATCH 1/3] remove Werror in upstream build scripts
removes -Werror in upstream build scripts. -Werror conflicts with
-D_FORTIFY_SOURCE=2 causing warnings to turn into errors.
Signed-off-by: Felix Kaechele <felix@kaechele.ca>
---
auto/cc/gcc | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/auto/cc/gcc b/auto/cc/gcc
index a5c5c18..cdbbadb 100644
--- a/auto/cc/gcc
+++ b/auto/cc/gcc
@@ -166,7 +166,9 @@ esac
# stop on warning
-CFLAGS="$CFLAGS -Werror"
+# This combined with Fedora's FORTIFY_SOURCE=2 option causes it nginx
+# to not compile.
+#CFLAGS="$CFLAGS -Werror"
# debug
CFLAGS="$CFLAGS -g"
--
2.31.1

View File

@ -1,8 +1,20 @@
From 4efd7b508fa018ca9def7f42c5887cf85bf2c23d Mon Sep 17 00:00:00 2001
From: Felix Kaechele <felix@kaechele.ca>
Date: Sun, 7 Jun 2020 12:14:54 -0400
Subject: [PATCH 2/3] change logs permissions to 664
This patch is carried downstream only.
Signed-off-by: Felix Kaechele <felix@kaechele.ca>
---
src/core/ngx_cycle.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/core/ngx_cycle.c b/src/core/ngx_cycle.c
index aee7a58..bcceecb 100644
index 6978c3e..1e2071c 100644
--- a/src/core/ngx_cycle.c
+++ b/src/core/ngx_cycle.c
@@ -1108,7 +1108,7 @@ ngx_reopen_files(ngx_cycle_t *cycle, ngx_uid_t user)
@@ -1195,7 +1195,7 @@ ngx_reopen_files(ngx_cycle_t *cycle, ngx_uid_t user)
}
fd = ngx_open_file(file[i].name.data, NGX_FILE_APPEND,
@ -11,3 +23,6 @@ index aee7a58..bcceecb 100644
ngx_log_debug3(NGX_LOG_DEBUG_EVENT, cycle->log, 0,
"reopen file \"%s\", old:%d new:%d",
--
2.31.1

View File

@ -0,0 +1,108 @@
From 5cfdf8607de1113d1dbbe1018030dc58aa7bbc0a Mon Sep 17 00:00:00 2001
From: Felix Kaechele <felix@kaechele.ca>
Date: Tue, 20 Apr 2021 21:28:18 -0400
Subject: [PATCH 3/3] fix PIDFile handling
Corresponding RHBZ: https://bugzilla.redhat.com/show_bug.cgi?id=1869026
Rejected upstream: https://trac.nginx.org/nginx/ticket/1897
Taken from: https://git.launchpad.net/ubuntu/+source/nginx/tree/debian/patches/nginx-fix-pidfile.patch
From original patch:
Author: Tj <ubuntu@iam.tj>
Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/nginx/+bug/1581864
Bug-Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=876365
iLast-Update: 2020-06-24
Signed-off-by: Felix Kaechele <felix@kaechele.ca>
---
src/core/nginx.c | 24 +++++++++++++++++++++---
src/os/unix/ngx_daemon.c | 8 ++++++--
2 files changed, 27 insertions(+), 5 deletions(-)
diff --git a/src/core/nginx.c b/src/core/nginx.c
index 48a20e9..32c0afe 100644
--- a/src/core/nginx.c
+++ b/src/core/nginx.c
@@ -339,14 +339,21 @@ main(int argc, char *const *argv)
ngx_process = NGX_PROCESS_MASTER;
}
+ /* tell-tale to detect if this is parent or child process */
+ ngx_int_t child_pid = NGX_BUSY;
+
#if !(NGX_WIN32)
if (ngx_init_signals(cycle->log) != NGX_OK) {
return 1;
}
+ /* tell-tale that this code has been executed */
+ child_pid--;
+
if (!ngx_inherited && ccf->daemon) {
- if (ngx_daemon(cycle->log) != NGX_OK) {
+ child_pid = ngx_daemon(cycle->log);
+ if (child_pid == NGX_ERROR) {
return 1;
}
@@ -359,8 +366,19 @@ main(int argc, char *const *argv)
#endif
- if (ngx_create_pidfile(&ccf->pid, cycle->log) != NGX_OK) {
- return 1;
+ /* If ngx_daemon() returned the child's PID in the parent process
+ * after the fork() set ngx_pid to the child_pid, which gets
+ * written to the PID file, then exit.
+ * For NGX_WIN32 always write the PID file
+ * For others, only write it from the parent process */
+ if (child_pid < NGX_OK || child_pid > NGX_OK) {
+ ngx_pid = child_pid > NGX_OK ? child_pid : ngx_pid;
+ if (ngx_create_pidfile(&ccf->pid, cycle->log) != NGX_OK) {
+ return 1;
+ }
+ }
+ if (child_pid > NGX_OK) {
+ exit(0);
}
if (ngx_log_redirect_stderr(cycle) != NGX_OK) {
diff --git a/src/os/unix/ngx_daemon.c b/src/os/unix/ngx_daemon.c
index 385c49b..3719854 100644
--- a/src/os/unix/ngx_daemon.c
+++ b/src/os/unix/ngx_daemon.c
@@ -7,14 +7,17 @@
#include <ngx_config.h>
#include <ngx_core.h>
+#include <unistd.h>
ngx_int_t
ngx_daemon(ngx_log_t *log)
{
int fd;
+ /* retain the return value for passing back to caller */
+ pid_t pid_child = fork();
- switch (fork()) {
+ switch (pid_child) {
case -1:
ngx_log_error(NGX_LOG_EMERG, log, ngx_errno, "fork() failed");
return NGX_ERROR;
@@ -23,7 +26,8 @@ ngx_daemon(ngx_log_t *log)
break;
default:
- exit(0);
+ /* let caller do the exit() */
+ return pid_child;
}
ngx_parent = ngx_pid;
--
2.31.1

View File

@ -1,30 +0,0 @@
-----BEGIN PGP PUBLIC KEY BLOCK-----
Version: GnuPG v1.4.12 (Darwin)
mQENBE+EK6YBCAC/0pVOAUxCXwkOY/g6B7wAoIerb57lfMUqGUIpyZdRlD9ZADtF
kZLQxvsyFkXxfoCZa0zCXT4CCbkYIVtuM5dDnwN4NH6vLxVFT+WhCXoL9MfPfSTp
bQQIQxeYtl8Rm+9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ee8wADR/OXGJVP6nKtVaY1h54ProAjG8fIZhF
SLokq7QVtFY8yyV7oAVAhB0vDE545d5TcTP29Wu6huJ7x94PQ2wuYmGV76m/05+3
sTrfPRVe4d8uW238UPxUMFdT7XQ9lDS0bskkYgDOWKk+iZ5HPe5tuK3aUl1QN6TZ
5qaprppB8+CxM2R7BFZD1pU0WicRGqPPhtnXKfuh/DOSBcQPw+dIjsKqXcyde1iE
pVfrZ1V5YpxVckTU+Zg5VrBhfez7Vazxt8f+rRVXcLKbZ1Z5KquqdrUzhkCISQQY
EQIACQUCSqEoFAIbDAAKCRCpN2E5pSTFPvnqAKCKuPJRzq+NTHlsyLiJhM8tQe43
ZgCeLScMWL6OD4W8wUkcEnEuw+6So80=
=bMVt
-----END PGP PUBLIC KEY BLOCK-----

View File

@ -1,13 +0,0 @@
--- auto/cc/gcc.orig 2007-03-22 08:34:53.000000000 -0600
+++ auto/cc/gcc 2007-03-22 08:58:47.000000000 -0600
@@ -172,7 +172,9 @@
# stop on warning
-CFLAGS="$CFLAGS -Werror"
+# This combined with Fedora's FORTIFY_SOURCE=2 option causes it nginx
+# to not compile.
+#CFLAGS="$CFLAGS -Werror"
# debug
CFLAGS="$CFLAGS -g"

View File

@ -1,6 +1,7 @@
[Unit]
Description=The nginx HTTP and reverse proxy server
After=network.target remote-fs.target nss-lookup.target
After=network-online.target remote-fs.target nss-lookup.target
Wants=network-online.target
[Service]
Type=forking

View File

@ -28,8 +28,8 @@
Name: nginx
Epoch: 1
Version: 1.18.0
Release: 5%{?dist}
Version: 1.20.0
Release: 1%{?dist}
Summary: A high performance web server and reverse proxy server
# BSD License (two clause)
@ -40,11 +40,9 @@ URL: https://nginx.org
Source0: https://nginx.org/download/nginx-%{version}.tar.gz
Source1: https://nginx.org/download/nginx-%{version}.tar.gz.asc
# Keys are found here: https://nginx.org/en/pgp_keys.html
Source2: https://nginx.org/keys/aalexeev.key
Source3: https://nginx.org/keys/is.key
Source4: https://nginx.org/keys/maxim.key
Source5: https://nginx.org/keys/mdounin.key
Source6: https://nginx.org/keys/sb.key
Source2: https://nginx.org/keys/maxim.key
Source3: https://nginx.org/keys/mdounin.key
Source4: https://nginx.org/keys/sb.key
Source10: nginx.service
Source11: nginx.logrotate
Source12: nginx.conf
@ -58,20 +56,24 @@ Source210: UPGRADE-NOTES-1.6-to-1.10
# removes -Werror in upstream build scripts. -Werror conflicts with
# -D_FORTIFY_SOURCE=2 causing warnings to turn into errors.
Patch0: nginx-auto-cc-gcc.patch
Patch0: 0001-remove-Werror-in-upstream-build-scripts.patch
# downstream patch - changing logs permissions to 664 instead
# previous 644
Patch2: nginx-1.12.1-logs-perm.patch
Patch1: 0002-change-logs-permissions-to-664.patch
BuildRequires: make
# downstream patch - fix PIDFile race condition (rhbz#1869026)
# rejected upstream: https://trac.nginx.org/nginx/ticket/1897
Patch2: 0003-fix-PIDFile-handling.patch
BuildRequires: make
BuildRequires: gcc
BuildRequires: gnupg2
%if 0%{?with_gperftools}
BuildRequires: gperftools-devel
%endif
BuildRequires: openssl-devel
BuildRequires: pcre-devel
BuildRequires: pcre2-devel
BuildRequires: zlib-devel
Requires: nginx-filesystem = %{epoch}:%{version}-%{release}
@ -195,11 +197,9 @@ Requires: nginx
%prep
# Combine all keys from upstream into one file
cat %{S:2} %{S:3} %{S:4} %{S:5} %{S:6} > %{_builddir}/%{name}.gpg
cat %{S:2} %{S:3} %{S:4} > %{_builddir}/%{name}.gpg
%{gpgverify} --keyring='%{_builddir}/%{name}.gpg' --signature='%{SOURCE1}' --data='%{SOURCE0}'
%setup -q
%patch0 -p0
%patch2 -p1
%autosetup -p1
cp %{SOURCE200} %{SOURCE210} %{SOURCE10} %{SOURCE12} .
%if 0%{?rhel} > 0 && 0%{?rhel} < 8
@ -232,43 +232,45 @@ if ! ./configure \
--lock-path=/run/lock/subsys/nginx \
--user=%{nginx_user} \
--group=%{nginx_user} \
--with-compat \
--with-debug \
%if 0%{?with_aio}
--with-file-aio \
%endif
--with-ipv6 \
--with-http_ssl_module \
--with-http_v2_module \
--with-http_realip_module \
--with-stream_ssl_preread_module \
%if 0%{?with_gperftools}
--with-google_perftools_module \
%endif
--with-http_addition_module \
--with-http_xslt_module=dynamic \
--with-http_image_filter_module=dynamic \
--with-http_auth_request_module \
--with-http_dav_module \
--with-http_degradation_module \
--with-http_flv_module \
%if %{with geoip}
--with-http_geoip_module=dynamic \
%endif
--with-http_sub_module \
--with-http_dav_module \
--with-http_flv_module \
--with-http_mp4_module \
--with-http_gunzip_module \
--with-http_gzip_static_module \
--with-http_random_index_module \
--with-http_secure_link_module \
--with-http_degradation_module \
--with-http_slice_module \
--with-http_stub_status_module \
--with-http_image_filter_module=dynamic \
--with-http_mp4_module \
--with-http_perl_module=dynamic \
--with-http_auth_request_module \
--with-http_random_index_module \
--with-http_realip_module \
--with-http_secure_link_module \
--with-http_slice_module \
--with-http_ssl_module \
--with-http_stub_status_module \
--with-http_sub_module \
--with-http_v2_module \
--with-http_xslt_module=dynamic \
--with-ipv6 \
--with-mail=dynamic \
--with-mail_ssl_module \
--with-pcre \
--with-pcre-jit \
--with-stream=dynamic \
--with-stream_ssl_module \
%if 0%{?with_gperftools}
--with-google_perftools_module \
%endif
--with-debug \
--with-stream_ssl_preread_module \
--with-threads \
--with-cc-opt="%{optflags} $(pcre-config --cflags)" \
--with-ld-opt="$nginx_ldopts"; then
: configure failed
@ -276,11 +278,11 @@ if ! ./configure \
exit 1
fi
make %{?_smp_mflags}
%make_build
%install
make install DESTDIR=%{buildroot} INSTALLDIRS=vendor
%make_install INSTALLDIRS=vendor
find %{buildroot} -type f -name .packlist -exec rm -f '{}' \;
find %{buildroot} -type f -name perllocal.pod -exec rm -f '{}' \;
@ -496,6 +498,15 @@ fi
%changelog
* Wed Apr 21 2021 Felix Kaechele <heffer@fedoraproject.org> - 1:1.20.0-1
- update to 1.20.0
- sync with mainline spec file
- order configure options alphabetically for easier comparinggit
- add --with-compat option (rhbz#1834452)
- add patch to fix PIDFile race condition (rhbz#1869026)
- use pcre2 instead of pcre (rhbz#1938984)
- add Wants=network-online.target to systemd unit (rhbz#1943779)
* Mon Feb 22 2021 Lubos Uhliarik <luhliari@redhat.com> - 1:1.18.0-5
- Resolves: #1931402 - drop gperftools module

View File

@ -1,2 +1,2 @@
SHA512 (nginx-1.18.0.tar.gz) = 8c21eeb62ab6e32e436932500f700bd2fb99fd2d29e43c08a5bfed4714c189c29c7141db551fcd5d2437303b7439f71758f7407dfd3e801e704e45e7daa78ddb
SHA512 (nginx-1.18.0.tar.gz.asc) = f6a8eaf7f8cdf3c32d7da916a046887a76ff8fbebf7d6b3e75a8ab243cb71e5aa0bdc0c88c2ebae6f0a128c7ee61fc129b4ba5cd9f0e5cfd4808e60c71ca8e4c
SHA512 (nginx-1.20.0.tar.gz.asc) = adc401a3f26461caec4cb3404ff7f2034baa799e03c0a9cd5ddc058a7ef41c29efc03d93a3c9b1794092319f611e29182092b610600c6f6beca6b881138bc22d
SHA512 (nginx-1.20.0.tar.gz) = 06433bde23610ab27deeb6bf8c78148e4249b603d194c81e71a08fc159caead07ea659510286fb6d02668d53b9afcdaabdde8692480ae83de4a531adc1b930ca