Bug 36121 - Including JSP's changes working directory
Including JSP's changes working directory
Status: RESOLVED FIXED
Product: Tomcat Connectors
Classification: Unclassified
Component: Common
unspecified
Other other
: P2 major (vote)
: ---
Assigned To: Tomcat Developers Mailing List
:
Depends on:
Blocks:
  Show dependency tree
 
Reported: 2005-08-10 15:25 UTC by Tom Scholten
Modified: 2008-10-05 03:09 UTC (History)
0 users



Attachments
Proposed patch (843 bytes, patch)
2006-10-03 20:23 UTC, Mark Thomas
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Tom Scholten 2005-08-10 15:25:07 UTC
Adding to the headers of the bug;
Apache 2.0.54 was used with mod_jk 1.2.13 on Redhat 9

Hi,

One of our customers uses SSI (mod_include) to include their jsp's

eg file index.shtml (located in /web/customer/www)
<!--#include virtual="top.html"-->
<!--#include virtual="active/news.jsp?${QUERY_STRING}"-->
<!--#include virtual="bottom.html"-->

What happens is that "top" and "news" are displayed correctly, but bottom fails
with "[an error occurred while processing this directive]". If we move the
include of "bottom.html" above the jsp line it works (besides from the webpage
not displaying as desired :)

The errorlog contains the following lines after requesting the page from apache;
File does not exist: /web/customer/www/active/bottom.html
unable to include "bottom.html" in parsed file /web/customer/www/index.shtml

If found Bug #34232 mentioning the same, but it was discarded as being apache
and/or mod_include. I didn't find any references to a new(er) ticket in ASF. The
current workaround for our customer would be to update their files to 'include
virtual="../bottom.html"' or revert back to their original "exec cgi" statements
(which worked, but we agreed with them upon that being deprecated).

For some reason the "include virtual" (or include file which causes the same)
that executes the 'jsp' sets the current working directory to "active" instead
of going 'back' to the directory where index.shtml was parsed from.

Any suggestions or options are welcome,

Tom
Comment 1 Tom Scholten 2005-08-17 14:25:18 UTC
Also reported Bug #36191 to Apache/mod_include but the conclusion was it wasn't
mod_include. Can anyone help us with this issue?

Tom
Comment 2 Mark Thomas 2005-09-21 01:01:15 UTC
I have replicated this problem with Apache 2.0.54 and JK 1.2.14 with the latest
versions (from SVN/CVS) of both TC4 and TC5.

It looks like the problem is in the native JK code but I am afraid I don't know
where to start looking. I am moving this issue to TC5 since that is the current
focus of development.
Comment 3 Yoav Shapira 2005-10-13 05:38:56 UTC
I don't have a fix for this yet (I'm not going to delve into JK for something
like this), but I would always caution against relying on a working directory as
a reference.  It's a bad practice that leads to reduced portability when it
doesn't outright fail.
Comment 4 Yoav Shapira 2005-12-01 23:00:46 UTC
Please post a WAR file we can use to reproduce this issue.
Comment 5 Mark Thomas 2006-10-03 20:23:45 UTC
Created attachment 18959 [details]
Proposed patch

I have been looking into this and have tracked down the root cause and have
identified a patch (attached) that fixes the issue. 

However, I am concerned about possible side-effects particularly with mod_dir.
I have tested this as far as my mod_jk understanding allows and I don't think
anything is broken but I would rather someone who knows the mod_jk codebase
rather better than I reviewed this patch before I commit it.
Comment 6 Mark Thomas 2006-11-23 16:18:14 UTC
Comment on attachment 18959 [details]
Proposed patch

I have done some more testing and the patch is bad - it causes some mod_dir
requests to fail. I'm working on a new patch.
Comment 7 Mark Thomas 2006-11-23 17:50:27 UTC
I have a new patch which I have tested with mod_dir and this test case and both
now work as expected. This fix will be included in the mod_jk 1.2.20 onwards.
Comment 8 Rainer Jung 2007-01-29 03:51:55 UTC
The patch caused other problems, see
http://issues.apache.org/bugzilla/show_bug.cgi?id=41430.

To find a good solution please participate in the discussion:

http://marc.theaimsgroup.com/?l=tomcat-dev&m=117007124924707&w=2
Comment 9 Mark Thomas 2007-09-06 20:38:56 UTC
This is still fixed in svn so I am marking this as fixed. If the fix for this
gets reverted, I will re-open this bug.