Opened 13 years ago
Closed 13 years ago
#22 closed enhancement (fixed)
Nginx 1.1.4 can't build on Debian hurd-i386
Reported by: | Cyril Lavier | Owned by: | somebody |
---|---|---|---|
Priority: | major | Milestone: | |
Component: | nginx-core | Version: | 1.1.x |
Keywords: | patch, build fail, hurd | Cc: | |
uname -a: | GNU debian 0.3 GNU-Mach 1.3.99/Hurd-0.3 i686-AT386 GNU | ||
nginx -V: | 1.1.4 |
Description
Hi.
For the Debian packaging purposes, I try to make Nginx working under the hurd-i386 kernel.
The error is the following.
gcc -c -pipe -O -W -Wall -Wpointer-arith -Wno-unused-parameter -Wunused-function -Wunused-variable -Wunused-value -Werror -g -I src/core -I src/event -I src/event/modules -I src/os/unix -I /usr/include/libxml2 -I objs -I src/http -I src/http/modules \ -o objs/src/http/ngx_http_variables.o \ src/http/ngx_http_variables.c src/http/ngx_http_variables.c: In function ‘ngx_http_variable_realpath_root’: src/http/ngx_http_variables.c:1160:37: error: ‘PATH_MAX’ undeclared (first use in this function) src/http/ngx_http_variables.c:1160:37: note: each undeclared identifier is reported only once for each function it appears in src/http/ngx_http_variables.c:1160:32: error: unused variable ‘real’ [-Werror=unused-variable] cc1: all warnings being treated as error
Under hurd, there is no PATH_MAX variable defined in the limits.h kernel header, and in any other header.
In order to have this issue corrected, I decided to set the PATH_MAX at 4096 (which is the common value in most Linux based systems). And after this, the build is working fine.
I attached a patch which does the trick.
I would like this patch to be applied upstream, as it will benefit all distributions providing a hurd kernel.
I'm working on the last version (1.1.4), and it can be applied/adapted on any other serie (1.0.x and 0.8.x), as Nginx always failed to build under hurd-i386.
Thanks.
Attachments (1)
Change History (6)
by , 13 years ago
Attachment: | define_PATH_MAX.patch added |
---|
comment:1 by , 13 years ago
Status: | new → accepted |
---|
(from http://mailman.nginx.org/pipermail/nginx/2011-September/029440.html)
There is a problem with this patch: nginx uses PATH_MAX to
allocate buffer used in realpath(), and POSIX claims:
: If resolved_name is not a null pointer and {PATH_MAX} is not
: defined as a constant in the <limits.h> header, the behavior is
: undefined.
http://pubs.opengroup.org/onlinepubs/9699919799/functions/realpath.html
Just using arbitrary value instead of PATH_MAX will likely lead to
a problem. If we want to avoid usage of PATH_MAX the relevant
code should be converted to use realpath() with NULL as
resolved_name.
Other current use of PATH_MAX is for getcwd() buffer which should
be ok with any buffer size as getcwd() interface includes "size"
argument.
comment:2 by , 13 years ago
Maybe nginx is just a wrong avenue and the patch should be rather pushed into hurd? ;-)
comment:3 by , 13 years ago
I believe hurd behavior is POSIX-complaint here, PATH_MAX isn't required to be known. And there is a way to not require PATH_MAX to be defined, see above. I'll look into it as time permits, unless someone will be faster. :)
Patch for setting the PATH_MAX value in src/os/unix/ngx_files.h