Opened 18 years ago
Last modified 8 years ago
#5 new defect
Detect recursive includes
Reported by: | cmlenz | Owned by: | cmlenz |
---|---|---|---|
Priority: | minor | Milestone: | 0.9 |
Component: | General | Version: | 0.6 |
Keywords: | Cc: |
Description
Recursive includes (foo.html including foo.html, or foo.html including bar.html including foo.html) should be detected and reported as an error. Currently, they result in an infinite loop.
Attachments (5)
Change History (12)
comment:1 Changed 18 years ago by cmlenz
- Priority changed from major to minor
comment:2 Changed 14 years ago by Carsten Klein <carsten.klein@…>
- Milestone set to 0.7
- Version set to 0.6
Changed 14 years ago by Carsten Klein <carsten.klein@…>
initial proposal. TODO text templates, cleanup and remaining issues
comment:3 Changed 14 years ago by Carsten Klein <carsten.klein@…>
Other issues with the provided patch:
wiki_view.html includes list_of_attachments.html and attach_file_form.html. list_of... in turn includes attach_file_form.html
This is incorrectly detected as a recursive inclusion right now.
comment:4 Changed 14 years ago by Carsten Klein <carsten.klein@…>
See the attached patch which eliminates the problem of attach_file_form.html being reported for having been recursively included.
The problem was that on instantiation of the template the backtrace list was not copied.
Changed 14 years ago by Carsten Klein <carsten.klein@…>
revised patch. eliminates issue with the backtrace list not being copied.
comment:5 Changed 14 years ago by Carsten Klein <carsten.klein@…>
With the latest patch the original error as shown in comment 1 is also eliminated.
Now it is cleanup time. Especially the RecursiveInclusionDetectedError? should be used so that clients of genshi can render these errors in a more appropriate fashion, e.g. provide source reference links and so on.
Changed 14 years ago by Carsten Klein <carsten.klein@…>
Some cleanup, now uses RecursiveInclusionError? exception, text template is still a TODO
Changed 14 years ago by Carsten Klein <carsten.klein@…>
Fixes issues with templates that cannot be found on the search path that were introduced during refactoring of the default template loader's load() method
Changed 14 years ago by Carsten Klein <carsten.klein@…>
Forgot to also change the text templates. However, text templates are still untested, if someone would test this would be most kind.
comment:6 Changed 14 years ago by Carsten Klein <carsten.klein@…>
BTW this patch might also provide a solution to the problem described in #328, as from now on, the absolute filepaths will be used for looking up and storing templates in the cache.
comment:7 Changed 8 years ago by hodgestar
- Milestone changed from 0.7 to 0.9
Moved to milestone 0.9.
Attached you find an initial patch that would solve the problem.
There are still some issues to be resolved, though.
Scenario:
In trac's site.html the user recursively includes layout.html. While this is not your common usecase, it will still have to be detected by the system.
And, with the provided patch it does, however, there are two different stack traces, one in the trac.log which is correct, and the one that you get in the browser, which is incorrect.
Here are the two stack traces, trac.log first
and the output in the browser
I am still investigating the issue, but until now I have not found a working solution to the problem.