Bug 4758 - --template {changeset} crashes because of infinite recursion
Summary: --template {changeset} crashes because of infinite recursion
Status: RESOLVED FIXED
Alias: None
Product: Mercurial
Classification: Unclassified
Component: templater (show other bugs)
Version: 3.3.2
Hardware: PC Linux
: normal bug
Assignee: Bugzilla
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-07-22 05:39 UTC by Ivan Ogai
Modified: 2016-10-06 02:25 UTC (History)
5 users (show)

See Also:
Python Version: ---


Attachments
stacktrace (84.52 KB, text/plain)
2015-07-22 05:40 UTC, Ivan Ogai
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Ivan Ogai 2015-07-22 05:39 UTC
Command failing: hg log --template "{changeset}\n"

RuntimeError: maximum recursion depth exceeded in __instancecheck__

See attached stacktrace.
Comment 1 Ivan Ogai 2015-07-22 05:40 UTC
Created attachment 1848 [details]
stacktrace
Comment 2 Yuya Nishihara 2015-07-22 09:14 UTC
Currently our templater isn't safe for circular reference:

  changeset = "{changeset}\n"
Comment 3 Pierre-Yves David 2015-07-27 14:31 UTC
Yuya: should we update the bug title with this ?
Comment 4 Bugzilla 2015-12-26 00:00 UTC
Bug was inactive for 150 days, archiving
Comment 5 Bryan O'Sullivan 2016-01-22 18:18 UTC
Has been spotted in the wild elsewhere.
Comment 6 HG Bot 2016-01-25 18:45 UTC
Fixed by https://selenic.com/repo/hg/rev/7ed3a3c0cef1
Yuya Nishihara <yuya@tcha.org>
templater: abort if infinite recursion detected while evaluation (issue4758)

It would be nice if we could detect recursion at the parsing phase, but we
can't because a template can refer to a keyword of the same name. For example,
"rev = {rev}" is valid if rev is a keyword, and we don't know if rev is a
keyword or a template while parsing.

(please test the fix)
Comment 7 Bugzilla 2016-02-02 00:00 UTC
Bug was set to TESTING for 7 days, resolving