New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Build hangs due to unintended template recursion #515
Comments
The lookup itself is by design. We should probably try to abort once we notice we're in a loop, though. Would you be interested in submitting a PR for that? This kind of thing probably happens around here: https://github.com/djc/askama/blob/main/askama_derive/src/lib.rs#L50, or inside the |
What about the case of the cycle in dependency ? |
What about it? Please be more explicit in what you're asking about. |
My apologies for that, the last comment suppose to be edited. As @Rapptz explains there is an issue of self-loop when This solution will solve the self-loop problem, but it will not work for the condition where So, to solve both of the cases should we use a |
I think the |
This got resolved with #539 . |
Apologies for the title, I wasn't sure how to properly phrase this.
While working on my project I ran into a scenario where
rustc
would hang indefinitely for some reason. After a laborious amount of time trying to debug and figure out the issue to produce a minimal example, it turned out that template searching does not work as I expect. For example, suppose the following directory structure was used:If
admin/index.html
has{% extends "base.html" %}
then the file that is included is the one given bytemplates/base.html
. Therefore, my expectation was that the lookup is based off of the root directory and not the relative directory. However, once the directory is modified andtemplates/admin/base.html
is created like so:Then running
{% extends "base.html" %}
from withintemplates/admin/base.html
does not look fortemplates/index.html
like before but instead it seems to recursively include itself causing the build to hang.I am unsure if this is by design, a user issue, or a bug within Askama. However, I figured there's no harm in documenting it here.
I have included a zip file of a minimal project layout demonstrating the hang
askama-bug.zip
The text was updated successfully, but these errors were encountered: