repair `patch: cant open` of no_poll

The command is `patch -p0 < nginx-no_pool.patch` when config `--no-pool-patch` option.
tests: `TEST 72: --with-no-pool-patch` to verify.
Its also repaired the following:
`Hunk 1 FAILED 10/10.`@src/core/nginx.h
`Hunk 1 FAILED 9/9.`@src/core/ngx_palloc.c

Mention here: ngx_palloc.c was effected by the dtrace patch.
pull/560/head
James ZHANG 6 years ago
parent 2c65141c39
commit 1a8109b82f

@ -1,8 +1,7 @@
diff --minimal '--exclude=*.swp' '--exclude=*~' -up nginx-1.17.4/src/core/nginx.h nginx-1.17.4-patched/src/core/nginx.h
diff --minimal '--exclude=*.swp' '--exclude=*~' -up nginx-1.17.4/src/core/nginx.h nginx-1.17.4/src/core/nginx.h
--- nginx-1.17.4/src/core/nginx.h 2016-04-19 09:02:38.000000000 -0700
+++ nginx-1.17.4-patched/src/core/nginx.h 2016-04-21 16:25:07.452944624 -0700
@@ -10,7 +10,7 @@
+++ nginx-1.17.4/src/core/nginx.h 2016-04-21 16:25:07.452944624 -0700
@@ -11,7 +11,7 @@
#define nginx_version 1017004
#define NGINX_VERSION "1.17.4"
@ -10,9 +9,10 @@ diff --minimal '--exclude=*.swp' '--exclude=*~' -up nginx-1.17.4/src/core/nginx.
+#define NGINX_VER "openresty/" NGINX_VERSION ".unknown (no pool)"
#ifdef NGX_BUILD
diff --minimal '--exclude=*.swp' '--exclude=*~' -up nginx-1.17.4/src/core/ngx_array.c nginx-1.17.4-patched/src/core/ngx_array.c
#define NGINX_VER_BUILD NGINX_VER " (" NGX_BUILD ")"
diff --minimal '--exclude=*.swp' '--exclude=*~' -up nginx-1.17.4/src/core/ngx_array.c nginx-1.17.4/src/core/ngx_array.c
--- nginx-1.17.4/src/core/ngx_array.c 2016-04-19 09:02:38.000000000 -0700
+++ nginx-1.17.4-patched/src/core/ngx_array.c 2016-04-21 16:25:07.453947190 -0700
+++ nginx-1.17.4/src/core/ngx_array.c 2016-04-21 16:25:07.453947190 -0700
@@ -30,26 +30,30 @@ ngx_array_create(ngx_pool_t *p, ngx_uint
void
ngx_array_destroy(ngx_array_t *a)
@ -160,9 +160,9 @@ diff --minimal '--exclude=*.swp' '--exclude=*~' -up nginx-1.17.4/src/core/ngx_ar
}
elt = (u_char *) a->elts + a->size * a->nelts;
diff --minimal '--exclude=*.swp' '--exclude=*~' -up nginx-1.17.4/src/core/ngx_array.h nginx-1.17.4-patched/src/core/ngx_array.h
diff --minimal '--exclude=*.swp' '--exclude=*~' -up nginx-1.17.4/src/core/ngx_array.h nginx-1.17.4/src/core/ngx_array.h
--- nginx-1.17.4/src/core/ngx_array.h 2016-04-19 09:02:38.000000000 -0700
+++ nginx-1.17.4-patched/src/core/ngx_array.h 2016-04-21 16:25:07.453947190 -0700
+++ nginx-1.17.4/src/core/ngx_array.h 2016-04-21 16:25:07.453947190 -0700
@@ -13,12 +13,23 @@
#include <ngx_core.h>
@ -195,11 +195,11 @@ diff --minimal '--exclude=*.swp' '--exclude=*~' -up nginx-1.17.4/src/core/ngx_ar
array->elts = ngx_palloc(pool, n * size);
if (array->elts == NULL) {
diff --minimal '--exclude=*.swp' '--exclude=*~' -up nginx-1.17.4/src/core/ngx_palloc.c nginx-1.17.4-patched/src/core/ngx_palloc.c
diff --minimal '--exclude=*.swp' '--exclude=*~' -up nginx-1.17.4/src/core/ngx_palloc.c nginx-1.17.4/src/core/ngx_palloc.c
--- nginx-1.17.4/src/core/ngx_palloc.c 2016-04-19 09:02:38.000000000 -0700
+++ nginx-1.17.4-patched/src/core/ngx_palloc.c 2016-04-21 16:25:45.912282685 -0700
@@ -9,34 +9,26 @@
#include <ngx_core.h>
+++ nginx-1.17.4/src/core/ngx_palloc.c 2016-04-21 16:25:45.912282685 -0700
@@ -10,34 +10,26 @@
#include <ngx_core_probe.h>
-static ngx_inline void *ngx_palloc_small(ngx_pool_t *pool, size_t size,
@ -237,8 +237,8 @@ diff --minimal '--exclude=*.swp' '--exclude=*~' -up nginx-1.17.4/src/core/ngx_pa
- p->cleanup = NULL;
p->log = log;
return p;
@@ -46,8 +38,7 @@ ngx_create_pool(size_t size, ngx_log_t *
ngx_core_probe_create_pool_done(p, size);
@@ -49,8 +41,7 @@ ngx_create_pool(size_t size, ngx_log_t *
void
ngx_destroy_pool(ngx_pool_t *pool)
{
@ -248,7 +248,7 @@ diff --minimal '--exclude=*.swp' '--exclude=*~' -up nginx-1.17.4/src/core/ngx_pa
ngx_pool_cleanup_t *c;
for (c = pool->cleanup; c; c = c->next) {
@@ -58,6 +49,11 @@ ngx_destroy_pool(ngx_pool_t *pool)
@@ -61,6 +52,11 @@ ngx_destroy_pool(ngx_pool_t *pool)
}
}
@ -260,7 +260,7 @@ diff --minimal '--exclude=*.swp' '--exclude=*~' -up nginx-1.17.4/src/core/ngx_pa
#if (NGX_DEBUG)
/*
@@ -65,13 +61,9 @@ ngx_destroy_pool(ngx_pool_t *pool)
@@ -68,13 +64,9 @@ ngx_destroy_pool(ngx_pool_t *pool)
* so we cannot use this log while free()ing the pool
*/
@ -276,7 +276,7 @@ diff --minimal '--exclude=*.swp' '--exclude=*~' -up nginx-1.17.4/src/core/ngx_pa
if (n == NULL) {
break;
@@ -80,171 +72,82 @@ ngx_destroy_pool(ngx_pool_t *pool)
@@ -83,171 +75,82 @@ ngx_destroy_pool(ngx_pool_t *pool)
#endif
@ -482,7 +482,7 @@ diff --minimal '--exclude=*.swp' '--exclude=*~' -up nginx-1.17.4/src/core/ngx_pa
return p;
}
@@ -253,38 +156,48 @@ void *
@@ -256,38 +159,48 @@ void *
ngx_pmemalign(ngx_pool_t *pool, size_t size, size_t alignment)
{
void *p;
@ -546,9 +546,9 @@ diff --minimal '--exclude=*.swp' '--exclude=*~' -up nginx-1.17.4/src/core/ngx_pa
return NGX_OK;
}
diff --minimal '--exclude=*.swp' '--exclude=*~' -up nginx-1.17.4/src/core/ngx_palloc.h nginx-1.17.4-patched/src/core/ngx_palloc.h
diff --minimal '--exclude=*.swp' '--exclude=*~' -up nginx-1.17.4/src/core/ngx_palloc.h nginx-1.17.4/src/core/ngx_palloc.h
--- nginx-1.17.4/src/core/ngx_palloc.h 2016-04-19 09:02:38.000000000 -0700
+++ nginx-1.17.4-patched/src/core/ngx_palloc.h 2016-04-21 16:25:07.454949755 -0700
+++ nginx-1.17.4/src/core/ngx_palloc.h 2016-04-21 16:25:07.454949755 -0700
@@ -38,28 +38,21 @@ struct ngx_pool_cleanup_s {
};

@ -2,7 +2,7 @@
use lib '.';
use t::Config;
plan tests => 273;
plan tests => 277;
#no_diff();
@ -5888,3 +5888,98 @@ install: all
clean:
rm -rf build *.exe *.dll openresty-*
=== TEST 72: --with-no-pool-patch
--- cmd: ./configure --with-no-pool-patch --dry-run
--- out
platform: linux (linux)
cp -rp bundle/ build
cd build
patch -p0 < nginx-no_pool.patch
patching file nginx-1.17.4/src/core/nginx.h
patching file nginx-1.17.4/src/core/ngx_array.c
patching file nginx-1.17.4/src/core/ngx_array.h
patching file nginx-1.17.4/src/core/ngx_palloc.c
patching file nginx-1.17.4/src/core/ngx_palloc.h
cd LuaJIT-2.1-20190912
INFO: found -msse4.2 in cc.
gmake TARGET_STRIP=@: CCDEBUG=-g XCFLAGS='-DLUAJIT_ENABLE_LUA52COMPAT -DLUAJIT_ENABLE_GC64 -msse4.2' CC=cc PREFIX=/usr/local/openresty/luajit
gmake install TARGET_STRIP=@: CCDEBUG=-g XCFLAGS='-DLUAJIT_ENABLE_LUA52COMPAT -DLUAJIT_ENABLE_GC64 -msse4.2' CC=cc PREFIX=/usr/local/openresty/luajit DESTDIR=$OPENRESTY_BUILD_DIR/luajit-root/
export LUAJIT_LIB='$OPENRESTY_BUILD_DIR/luajit-root/usr/local/openresty/luajit/lib'
export LUAJIT_INC='$OPENRESTY_BUILD_DIR/luajit-root/usr/local/openresty/luajit/include/luajit-2.1'
cd ..
patching the resty script with hard-coded nginx binary path...
cd nginx-1.17.4
sh ./configure --prefix=/usr/local/openresty/nginx \
--with-cc-opt='-O2' \
--add-module=../ngx_devel_kit-0.3.1rc1 \
--add-module=../echo-nginx-module-0.61 \
--add-module=../xss-nginx-module-0.06 \
--add-module=../ngx_coolkit-0.2 \
--add-module=../set-misc-nginx-module-0.32 \
--add-module=../form-input-nginx-module-0.12 \
--add-module=../encrypted-session-nginx-module-0.08 \
--add-module=../srcache-nginx-module-0.31 \
--add-module=../ngx_lua-0.10.15 \
--add-module=../ngx_lua_upstream-0.07 \
--add-module=../headers-more-nginx-module-0.33 \
--add-module=../array-var-nginx-module-0.05 \
--add-module=../memc-nginx-module-0.19 \
--add-module=../redis2-nginx-module-0.15 \
--add-module=../redis-nginx-module-0.3.7 \
--add-module=../rds-json-nginx-module-0.15 \
--add-module=../rds-csv-nginx-module-0.09 \
--add-module=../ngx_stream_lua-0.0.7 \
--with-ld-opt='-Wl,-rpath,/usr/local/openresty/luajit/lib' \
--with-stream --with-stream_ssl_module --with-stream_ssl_preread_module --with-http_ssl_module
cd ../..
Type the following commands to build and install:
gmake
gmake install
--- makefile
.PHONY: all install clean
all:
cd $OPENRESTY_BUILD_DIR/LuaJIT-2.1-20190912 && $(MAKE) TARGET_STRIP=@: CCDEBUG=-g XCFLAGS='-DLUAJIT_ENABLE_LUA52COMPAT -DLUAJIT_ENABLE_GC64 -msse4.2' CC=cc PREFIX=/usr/local/openresty/luajit
cd $OPENRESTY_BUILD_DIR/lua-cjson-2.1.0.7 && $(MAKE) DESTDIR=$(DESTDIR) LUA_INCLUDE_DIR=$OPENRESTY_BUILD_DIR/luajit-root/usr/local/openresty/luajit/include/luajit-2.1 LUA_CMODULE_DIR=/usr/local/openresty/lualib LUA_MODULE_DIR=/usr/local/openresty/lualib CJSON_CFLAGS="-g -fpic" CC=cc
cd $OPENRESTY_BUILD_DIR/lua-resty-signal-0.02 && $(MAKE) DESTDIR=$(DESTDIR) LUA_INCLUDE_DIR=$OPENRESTY_BUILD_DIR/luajit-root/usr/local/openresty/luajit/include/luajit-2.1 LUA_LIB_DIR=/usr/local/openresty/lualib CC=cc
cd $OPENRESTY_BUILD_DIR/lua-redis-parser-0.13 && $(MAKE) DESTDIR=$(DESTDIR) LUA_INCLUDE_DIR=$OPENRESTY_BUILD_DIR/luajit-root/usr/local/openresty/luajit/include/luajit-2.1 LUA_LIB_DIR=/usr/local/openresty/lualib CC=cc
cd $OPENRESTY_BUILD_DIR/lua-rds-parser-0.06 && $(MAKE) DESTDIR=$(DESTDIR) LUA_INCLUDE_DIR=$OPENRESTY_BUILD_DIR/luajit-root/usr/local/openresty/luajit/include/luajit-2.1 LUA_LIB_DIR=/usr/local/openresty/lualib CC=cc
cd $OPENRESTY_BUILD_DIR/nginx-1.17.4 && $(MAKE)
install: all
mkdir -p $(DESTDIR)/usr/local/openresty/
-cp $OPENRESTY_DIR/COPYRIGHT $(DESTDIR)/usr/local/openresty/
cd $OPENRESTY_BUILD_DIR/LuaJIT-2.1-20190912 && $(MAKE) install TARGET_STRIP=@: CCDEBUG=-g XCFLAGS='-DLUAJIT_ENABLE_LUA52COMPAT -DLUAJIT_ENABLE_GC64 -msse4.2' CC=cc PREFIX=/usr/local/openresty/luajit DESTDIR=$(DESTDIR)
cd $OPENRESTY_BUILD_DIR/lua-cjson-2.1.0.7 && $(MAKE) install DESTDIR=$(DESTDIR) LUA_INCLUDE_DIR=$OPENRESTY_BUILD_DIR/luajit-root/usr/local/openresty/luajit/include/luajit-2.1 LUA_CMODULE_DIR=/usr/local/openresty/lualib LUA_MODULE_DIR=/usr/local/openresty/lualib CJSON_CFLAGS="-g -fpic" CC=cc
cd $OPENRESTY_BUILD_DIR/lua-resty-signal-0.02 && $(MAKE) install DESTDIR=$(DESTDIR) LUA_INCLUDE_DIR=$OPENRESTY_BUILD_DIR/luajit-root/usr/local/openresty/luajit/include/luajit-2.1 LUA_LIB_DIR=/usr/local/openresty/lualib CC=cc
cd $OPENRESTY_BUILD_DIR/lua-redis-parser-0.13 && $(MAKE) install DESTDIR=$(DESTDIR) LUA_INCLUDE_DIR=$OPENRESTY_BUILD_DIR/luajit-root/usr/local/openresty/luajit/include/luajit-2.1 LUA_LIB_DIR=/usr/local/openresty/lualib CC=cc
cd $OPENRESTY_BUILD_DIR/lua-rds-parser-0.06 && $(MAKE) install DESTDIR=$(DESTDIR) LUA_INCLUDE_DIR=$OPENRESTY_BUILD_DIR/luajit-root/usr/local/openresty/luajit/include/luajit-2.1 LUA_LIB_DIR=/usr/local/openresty/lualib CC=cc
cd $OPENRESTY_BUILD_DIR/lua-resty-dns-0.21 && $(MAKE) install DESTDIR=$(DESTDIR) LUA_LIB_DIR=/usr/local/openresty/lualib INSTALL=$OPENRESTY_BUILD_DIR/install
cd $OPENRESTY_BUILD_DIR/lua-resty-memcached-0.14 && $(MAKE) install DESTDIR=$(DESTDIR) LUA_LIB_DIR=/usr/local/openresty/lualib INSTALL=$OPENRESTY_BUILD_DIR/install
cd $OPENRESTY_BUILD_DIR/lua-resty-redis-0.27 && $(MAKE) install DESTDIR=$(DESTDIR) LUA_LIB_DIR=/usr/local/openresty/lualib INSTALL=$OPENRESTY_BUILD_DIR/install
cd $OPENRESTY_BUILD_DIR/lua-resty-mysql-0.21 && $(MAKE) install DESTDIR=$(DESTDIR) LUA_LIB_DIR=/usr/local/openresty/lualib INSTALL=$OPENRESTY_BUILD_DIR/install
cd $OPENRESTY_BUILD_DIR/lua-resty-string-0.12rc1 && $(MAKE) install DESTDIR=$(DESTDIR) LUA_LIB_DIR=/usr/local/openresty/lualib INSTALL=$OPENRESTY_BUILD_DIR/install
cd $OPENRESTY_BUILD_DIR/lua-resty-upload-0.10 && $(MAKE) install DESTDIR=$(DESTDIR) LUA_LIB_DIR=/usr/local/openresty/lualib INSTALL=$OPENRESTY_BUILD_DIR/install
cd $OPENRESTY_BUILD_DIR/lua-resty-websocket-0.07 && $(MAKE) install DESTDIR=$(DESTDIR) LUA_LIB_DIR=/usr/local/openresty/lualib INSTALL=$OPENRESTY_BUILD_DIR/install
cd $OPENRESTY_BUILD_DIR/lua-resty-lock-0.08 && $(MAKE) install DESTDIR=$(DESTDIR) LUA_LIB_DIR=/usr/local/openresty/lualib INSTALL=$OPENRESTY_BUILD_DIR/install
cd $OPENRESTY_BUILD_DIR/lua-resty-lrucache-0.09 && $(MAKE) install DESTDIR=$(DESTDIR) LUA_LIB_DIR=/usr/local/openresty/lualib INSTALL=$OPENRESTY_BUILD_DIR/install
cd $OPENRESTY_BUILD_DIR/lua-resty-core-0.1.17 && $(MAKE) install DESTDIR=$(DESTDIR) LUA_LIB_DIR=/usr/local/openresty/lualib INSTALL=$OPENRESTY_BUILD_DIR/install
cd $OPENRESTY_BUILD_DIR/lua-resty-upstream-healthcheck-0.06 && $(MAKE) install DESTDIR=$(DESTDIR) LUA_LIB_DIR=/usr/local/openresty/lualib INSTALL=$OPENRESTY_BUILD_DIR/install
cd $OPENRESTY_BUILD_DIR/lua-resty-limit-traffic-0.06 && $(MAKE) install DESTDIR=$(DESTDIR) LUA_LIB_DIR=/usr/local/openresty/lualib INSTALL=$OPENRESTY_BUILD_DIR/install
cd $OPENRESTY_BUILD_DIR/lua-resty-shell-0.02 && $(MAKE) install DESTDIR=$(DESTDIR) LUA_LIB_DIR=/usr/local/openresty/lualib INSTALL=$OPENRESTY_BUILD_DIR/install
cd $OPENRESTY_BUILD_DIR/lua-tablepool-0.01 && $(MAKE) install DESTDIR=$(DESTDIR) LUA_LIB_DIR=/usr/local/openresty/lualib INSTALL=$OPENRESTY_BUILD_DIR/install
cd $OPENRESTY_BUILD_DIR/opm-0.0.5 && $OPENRESTY_BUILD_DIR/install bin/* $(DESTDIR)/usr/local/openresty/bin/
cd $OPENRESTY_BUILD_DIR/resty-cli-0.25rc2 && $OPENRESTY_BUILD_DIR/install bin/* $(DESTDIR)/usr/local/openresty/bin/
cp $OPENRESTY_BUILD_DIR/resty.index $(DESTDIR)/usr/local/openresty/
cp -r $OPENRESTY_BUILD_DIR/pod $(DESTDIR)/usr/local/openresty/
cd $OPENRESTY_BUILD_DIR/nginx-1.17.4 && $(MAKE) install DESTDIR=$(DESTDIR)
mkdir -p $(DESTDIR)/usr/local/openresty/site/lualib $(DESTDIR)/usr/local/openresty/site/pod $(DESTDIR)/usr/local/openresty/site/manifest
ln -sf /usr/local/openresty/nginx/sbin/nginx $(DESTDIR)/usr/local/openresty/bin/openresty
clean:
rm -rf build *.exe *.dll openresty-*

Loading…
Cancel
Save