Skip to content

Commit

Permalink
fix nginx bug under gcc8
Browse files Browse the repository at this point in the history
  • Loading branch information
licess committed May 28, 2018
1 parent 0e87b4d commit 73262b4
Show file tree
Hide file tree
Showing 3 changed files with 189 additions and 0 deletions.
3 changes: 3 additions & 0 deletions include/nginx.sh
Expand Up @@ -64,6 +64,9 @@ Install_Nginx()
if [[ "${DISTRO}" = "Fedora" && "${Fedora_Version}" = "28" ]]; then
patch -p1 < ${cur_dir}/src/patch/nginx-libxcrypt.patch
fi
if gcc -dumpversion|grep -q "^[8]"; then
patch -p1 < ${cur_dir}/src/patch/nginx-gcc8.patch
fi
if echo ${Nginx_Ver} | grep -Eqi 'nginx-[0-1].[5-8].[0-9]' || echo ${Nginx_Ver} | grep -Eqi 'nginx-1.9.[1-4]$'; then
./configure --user=www --group=www --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_ssl_module --with-http_spdy_module --with-http_gzip_static_module --with-ipv6 --with-http_sub_module ${Nginx_With_Openssl} ${Nginx_Module_Lua} ${NginxMAOpt} ${Nginx_Modules_Options}
else
Expand Down
3 changes: 3 additions & 0 deletions include/upgrade_nginx.sh
Expand Up @@ -51,6 +51,9 @@ Upgrade_Nginx()
if [[ "${DISTRO}" = "Fedora" && "${Fedora_Version}" = "28" ]]; then
patch -p1 < ${cur_dir}/src/patch/nginx-libxcrypt.patch
fi
if gcc -dumpversion|grep -q "^[8]"; then
patch -p1 < ${cur_dir}/src/patch/nginx-gcc8.patch
fi
if echo ${Nginx_Version} | grep -Eqi '^[0-1].[5-8].[0-9]' || echo ${Nginx_Version} | grep -Eqi '^1.9.[1-4]$'; then
./configure --user=www --group=www --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_ssl_module --with-http_spdy_module --with-http_gzip_static_module --with-ipv6 --with-http_sub_module ${Nginx_With_Openssl} ${Nginx_Module_Lua} ${NginxMAOpt} ${Nginx_Modules_Options}
else
Expand Down
183 changes: 183 additions & 0 deletions src/patch/nginx-gcc8.patch
@@ -0,0 +1,183 @@
diff -ruN a/src/http/modules/ngx_http_fastcgi_module.c b/src/http/modules/ngx_http_fastcgi_module.c
--- a/src/http/modules/ngx_http_fastcgi_module.c 2018-04-17 23:22:36.000000000 +0800
+++ b/src/http/modules/ngx_http_fastcgi_module.c 2018-05-28 09:10:46.443271547 +0800
@@ -3264,7 +3264,8 @@
return NGX_ERROR;
}

- copy->code = (ngx_http_script_code_pt) ngx_http_script_copy_len_code;
+ copy->code = (ngx_http_script_code_pt) (void *)
+ ngx_http_script_copy_len_code;
copy->len = src[i].key.len;

copy = ngx_array_push_n(params->lengths,
@@ -3273,7 +3274,8 @@
return NGX_ERROR;
}

- copy->code = (ngx_http_script_code_pt) ngx_http_script_copy_len_code;
+ copy->code = (ngx_http_script_code_pt) (void *)
+ ngx_http_script_copy_len_code;
copy->len = src[i].skip_empty;


diff -ruN a/src/http/modules/ngx_http_grpc_module.c b/src/http/modules/ngx_http_grpc_module.c
--- a/src/http/modules/ngx_http_grpc_module.c 2018-04-17 23:22:36.000000000 +0800
+++ b/src/http/modules/ngx_http_grpc_module.c 2018-05-28 09:10:46.444271550 +0800
@@ -4389,7 +4389,8 @@
return NGX_ERROR;
}

- copy->code = (ngx_http_script_code_pt) ngx_http_script_copy_len_code;
+ copy->code = (ngx_http_script_code_pt) (void *)
+ ngx_http_script_copy_len_code;
copy->len = src[i].key.len;

size = (sizeof(ngx_http_script_copy_code_t)
diff -ruN a/src/http/modules/ngx_http_proxy_module.c b/src/http/modules/ngx_http_proxy_module.c
--- a/src/http/modules/ngx_http_proxy_module.c 2018-04-17 23:22:36.000000000 +0800
+++ b/src/http/modules/ngx_http_proxy_module.c 2018-05-28 09:10:46.445271553 +0800
@@ -3493,7 +3493,8 @@
return NGX_ERROR;
}

- copy->code = (ngx_http_script_code_pt) ngx_http_script_copy_len_code;
+ copy->code = (ngx_http_script_code_pt) (void *)
+ ngx_http_script_copy_len_code;
copy->len = src[i].key.len;

size = (sizeof(ngx_http_script_copy_code_t)
diff -ruN a/src/http/modules/ngx_http_scgi_module.c b/src/http/modules/ngx_http_scgi_module.c
--- a/src/http/modules/ngx_http_scgi_module.c 2018-04-17 23:22:36.000000000 +0800
+++ b/src/http/modules/ngx_http_scgi_module.c 2018-05-28 09:10:46.445271553 +0800
@@ -1724,7 +1724,8 @@
return NGX_ERROR;
}

- copy->code = (ngx_http_script_code_pt) ngx_http_script_copy_len_code;
+ copy->code = (ngx_http_script_code_pt) (void *)
+ ngx_http_script_copy_len_code;
copy->len = src[i].key.len + 1;

copy = ngx_array_push_n(params->lengths,
@@ -1733,7 +1734,8 @@
return NGX_ERROR;
}

- copy->code = (ngx_http_script_code_pt) ngx_http_script_copy_len_code;
+ copy->code = (ngx_http_script_code_pt) (void *)
+ ngx_http_script_copy_len_code;
copy->len = src[i].skip_empty;


diff -ruN a/src/http/modules/ngx_http_uwsgi_module.c b/src/http/modules/ngx_http_uwsgi_module.c
--- a/src/http/modules/ngx_http_uwsgi_module.c 2018-04-17 23:22:36.000000000 +0800
+++ b/src/http/modules/ngx_http_uwsgi_module.c 2018-05-28 09:10:46.446271556 +0800
@@ -1987,7 +1987,8 @@
return NGX_ERROR;
}

- copy->code = (ngx_http_script_code_pt) ngx_http_script_copy_len_code;
+ copy->code = (ngx_http_script_code_pt) (void *)
+ ngx_http_script_copy_len_code;
copy->len = src[i].key.len;

copy = ngx_array_push_n(params->lengths,
@@ -1996,7 +1997,8 @@
return NGX_ERROR;
}

- copy->code = (ngx_http_script_code_pt) ngx_http_script_copy_len_code;
+ copy->code = (ngx_http_script_code_pt) (void *)
+ ngx_http_script_copy_len_code;
copy->len = src[i].skip_empty;


diff -ruN a/src/http/ngx_http_script.c b/src/http/ngx_http_script.c
--- a/src/http/ngx_http_script.c 2018-04-17 23:22:36.000000000 +0800
+++ b/src/http/ngx_http_script.c 2018-05-28 09:10:46.446271556 +0800
@@ -695,7 +695,8 @@
return NGX_ERROR;
}

- code->code = (ngx_http_script_code_pt) ngx_http_script_copy_len_code;
+ code->code = (ngx_http_script_code_pt) (void *)
+ ngx_http_script_copy_len_code;
code->len = len;

size = (sizeof(ngx_http_script_copy_code_t) + len + sizeof(uintptr_t) - 1)
@@ -784,7 +785,8 @@
return NGX_ERROR;
}

- code->code = (ngx_http_script_code_pt) ngx_http_script_copy_var_len_code;
+ code->code = (ngx_http_script_code_pt) (void *)
+ ngx_http_script_copy_var_len_code;
code->index = (uintptr_t) index;

code = ngx_http_script_add_code(*sc->values,
@@ -1178,8 +1180,8 @@
return NGX_ERROR;
}

- code->code = (ngx_http_script_code_pt)
- ngx_http_script_copy_capture_len_code;
+ code->code = (ngx_http_script_code_pt) (void *)
+ ngx_http_script_copy_capture_len_code;
code->n = 2 * n;


@@ -1293,7 +1295,8 @@
return NGX_ERROR;
}

- code->code = (ngx_http_script_code_pt) ngx_http_script_full_name_len_code;
+ code->code = (ngx_http_script_code_pt) (void *)
+ ngx_http_script_full_name_len_code;
code->conf_prefix = sc->conf_prefix;

code = ngx_http_script_add_code(*sc->values,
diff -ruN a/src/stream/ngx_stream_script.c b/src/stream/ngx_stream_script.c
--- a/src/stream/ngx_stream_script.c 2018-04-17 23:22:37.000000000 +0800
+++ b/src/stream/ngx_stream_script.c 2018-05-28 09:14:11.420949014 +0800
@@ -587,7 +587,8 @@
return NGX_ERROR;
}

- code->code = (ngx_stream_script_code_pt) ngx_stream_script_copy_len_code;
+ code->code = (ngx_stream_script_code_pt) (void *)
+ ngx_stream_script_copy_len_code;
code->len = len;

size = (sizeof(ngx_stream_script_copy_code_t) + len + sizeof(uintptr_t) - 1)
@@ -677,8 +678,8 @@
return NGX_ERROR;
}

- code->code = (ngx_stream_script_code_pt)
- ngx_stream_script_copy_var_len_code;
+ code->code = (ngx_stream_script_code_pt) (void *)
+ ngx_stream_script_copy_var_len_code;
code->index = (uintptr_t) index;

code = ngx_stream_script_add_code(*sc->values,
@@ -767,8 +768,8 @@
return NGX_ERROR;
}

- code->code = (ngx_stream_script_code_pt)
- ngx_stream_script_copy_capture_len_code;
+ code->code = (ngx_stream_script_code_pt) (void *)
+ ngx_stream_script_copy_capture_len_code;
code->n = 2 * n;


@@ -859,7 +860,7 @@
return NGX_ERROR;
}

- code->code = (ngx_stream_script_code_pt)
+ code->code = (ngx_stream_script_code_pt) (void *)
ngx_stream_script_full_name_len_code;
code->conf_prefix = sc->conf_prefix;

0 comments on commit 73262b4

Please sign in to comment.