Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 8 Mar 2010 09:10:23 -0800 (PST)
From:      Benoit Sigoure <tsuna@striterax.tsunanet.net>
To:        FreeBSD-gnats-submit@FreeBSD.org
Subject:   ports/144557: nginx-devel / fancyindex bug when nginx can't stat a file.
Message-ID:  <201003081710.o28HAN1p090668@striterax.tsunanet.net>
Resent-Message-ID: <201003081730.o28HU5qW004763@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         144557
>Category:       ports
>Synopsis:       nginx-devel / fancyindex bug when nginx can't stat a file.
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Mon Mar 08 17:30:05 UTC 2010
>Closed-Date:
>Last-Modified:
>Originator:     Benoit "tsuna" Sigoure
>Release:        FreeBSD 7.1-STABLE-200902 i386
>Organization:
>Environment:
System: FreeBSD striterax.tsunanet.net 7.1-STABLE-200902 FreeBSD 7.1-STABLE-200902 #0: Fri Feb 20 23:52:56 UTC 2009 root@logan.cse.buffalo.edu:/usr/obj/usr/src/sys/GENERIC i386


>Description:
	The fancyindex module fails to produce any output when
        attempting to list a directory in which one of the files or
        subdirectories can't be stat()ed by nginx.
        The client effectively gets no reply from server.

        This module doesn't seem to be maintained by its original
        author so I'm hoping that my patch can at least make its
        way to the FreeBSD ports.
>How-To-Repeat:
	1. Install nginx-devel (e.g. current version = 0.8.34) through ports,
           enable the fancyindex module at configure time.
        2. Turn on fancyindex ("fancyindex on;" in nginx.conf).
        3. Browse to a directory with fancyindex that contains a subdirectory
           with permissions such that nginx's process can't stat() it.
        4. Your browser won't get a reply from nginx.  In nginx-access.log the
           query will be logged as having a response code of "0".
>Fix:

	Apply the patch attached before building nginx with fancyindex.

--- 0001-Don-t-error-out-when-a-file-can-t-be-stat-ed.patch begins here ---
>From e8bb0121a1c1026a3b14a4f9bcc39a0d0e38c5fd Mon Sep 17 00:00:00 2001
From: Benoit Sigoure <tsunanet@gmail.com>
Date: Sun, 7 Mar 2010 21:06:35 -0800

Whenever a directory contained a file that couldn't be stat()ed by nginx
(e.g. due to EACCESS), the fancyindex module would produce an error and
wouldn't generate any response to the user.

The new behavior is to log a non-critical error and keep serving the page
anyway.

Signed-off-by: Benoit Sigoure <tsunanet@gmail.com>
---
 ngx_http_fancyindex_module.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/ngx_http_fancyindex_module.c b/ngx_http_fancyindex_module.c
index 06e1a9a..a099fb2 100644
--- a/ngx_http_fancyindex_module.c
+++ b/ngx_http_fancyindex_module.c
@@ -397,9 +397,9 @@ make_content_buf(
                 ngx_int_t err = ngx_errno;
 
                 if (err != NGX_ENOENT) {
-                    ngx_log_error(NGX_LOG_CRIT, r->connection->log, err,
+                    ngx_log_error(NGX_LOG_ERR, r->connection->log, err,
                             ngx_de_info_n " \"%s\" failed", filename);
-                    return ngx_http_fancyindex_error(r, &dir, &path);
+                    continue;
                 }
 
                 if (ngx_de_link_info(filename, &dir) == NGX_FILE_ERROR) {
-- 
1.7.0.2.157.gb7e7f
--- 0001-Don-t-error-out-when-a-file-can-t-be-stat-ed.patch ends here ---


>Release-Note:
>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201003081710.o28HAN1p090668>