Eval wildcard system
@timothytrippel 已经在做这个了。
开始于 2025年9月22日。
评估
这个 Issue 还没有评估数据。
描述
The eval_cmd feature is questionable to begin with as it encourages mixing config and behavioural logic. Having good separation between logic and config is generally considered to result in a more robust and maintainable long term solution. At some point it might be good to consider removing that feature and replacing it with a plug-in system that gives the same functionality without the issues associated with blindly executing arbitrary strings in configuration when loading the config file.
There are not many uses of this in OT, so it's feasible to remove, with some effort.
Implementation issues
In the short term, the main issue with the implementation of this feature is that eval_cmd only has a start delimiter. Which means that if the wildcards are substituted in a different order then arbitrary text will be executed. This is a slightly contrived example, as DVSim has direct support for using environment variables as wildcards. However conceptually this demonstration shows real a real bug that I've seen.
{
"a": "{eval_cmd} env | grep PWD",
"b": "{a}/sub/dir"
}
If a is resolved before b, then b might contain what you expect:
~/opentitan/sub/dir
However if for some reason b is resolved before a, then we get:
{
"a": "{eval_cmd} env | grep PWD",
"b": "{eval_cmd} env | grep PWD/sub/dir"
}
Which in a second pass becomes:
{
"a": "~/opentitan",
"b": ""
}
There are two issues here:
- The operations are not commutative - the order matters
- The eval command should only be run once and the result then propagated. Right now if the wildcard is substituted before it's evaluated, then the shell commands are run multiple times for no reason.
Proposal
Short term, fix the wildcard substitution so that it is commutative. Potential solutions are:
- Do not use the value of a field anywhere else until it's been evaluated? This may cause issues in terms of dependency loops, and complicate the algorithm?
- Add an end delimiter before substituting
The delimiter idea could be implemented by moving the arguments within the enclosing brackets. For example use the format {eval_cmd arguments ...} as a replacement for {eval_cmd} arguments .... As part of the migration step the old form could be automatically converted. Which means that if the string contains {eval_cmd} then attempt to evaluate it, if that's not possible right now as it contains unresolved wildcards, then convert it to the new format.
Long term, ideally we find a way of implementing the required functionality without the {eval_cmd} feature.
- 主要语言
- Python
- 星标
- 15
- 派生
- 22
- 平均合并
- 4 天 3 小时
- 30 天内合并 PR
- 7
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
lowRISC/dvsim 的其他 Issue
-
bug
难度 2/5 1-3 小时 新手友好度 84/100
-
难度 2/5 1-3 小时 新手友好度 68/100
-
难度 2/5 1-3 小时 新手友好度 72/100
-
难度 4/5 3-5 天 新手友好度 35/100
-
Better log visibility on the license type usage profile可能已有人在做 @AlexJones0 于 15 天前认领。 未关闭
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 72/100
huggingface/sentence-transformers#4186 ·
维护者通常 5 天内回复
-
documentation good first issue
难度 2/5 半天 新手友好度 72/100
sujithputta02/Esapay#13 ·
-
bot-triaged module: correctness (silent) module: mps module: NaNs and Infs triage review
难度 2/5 半天 新手友好度 62/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 68/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 62/100
SCIInstitute/SCIRun#2842 ·
维护者通常 3 天内回复