with_output_to_variable runs its commands outside the caller's scope and hides errors
メンテナーはふだん 1 日以内に返信
評価
- 難易度
- 2/5
- 見積もり時間
- 1〜3時間
- 初心者へのやさしさ
- 78/100
- issue の種類
- バグ
- 明瞭さ
- 明確に書かれている
- 活発さ
- 活発
- 領域
- tooling
調査の方向性
tcl/CmdUtil.tcl の with_output_to_variable から始め、issue が例として挙げている tcl/Util.tcl の proc_redirect と動作を比較します。示されている Tcl の例を使ってスコープとエラーの挙動を確認し、既存の回避策である test/set_path_margin_common.tcl も確認します。出力のリダイレクト終了後に、コマンドから呼び出し元の変数にアクセスでき、エラーが呼び出し元に伝わるようになれば完了です。
索引モデルが issue の本文から書いたものです。
説明
with_output_to_variable evaluates its commands inside its own proc, not in the caller's scope, and it swallows any error they raise.
Inside a proc, a body that uses the proc's local variables fails, but the failure is hidden: the output variable is just empty. For example:
proc capture { pin } {
with_output_to_variable out { report_edges -from [get_pins $pin] }
return $out
}
puts "<[capture reg1/CK]>"
This prints <> with no error, because $pin doesn't exist in with_output_to_variable's frame. At the top level the body can't see local variables either, and variables it sets are lost:
with_output_to_variable out { set x 1; report_units }
puts $x ;# can't read "x": no such variable
Errors are caught and returned as the command's result:
puts [catch {with_output_to_variable v { report_units; error boom }} msg]
# prints 0; msg is "boom"
Callers can't tell that the commands failed and that the captured output is incomplete. Some tests work around the scope problem. For example, test/set_path_margin_common.tcl builds the body with [list report_checks {*}$args -format json] so that $args is substituted before the call.
parallaxsw/OpenSTA master has the same code.
Cause
tcl/CmdUtil.tcl:
proc with_output_to_variable { var_name args } {
upvar 1 $var_name var
set body [lindex $args 0]
sta::redirect_string_begin;
catch $body ret
set var [sta::redirect_string_end]
return $ret
}
catch $body runs the body in the proc's frame, and the catch result code is discarded. The body should be run with uplevel 1, and an error should be re-raised once the redirection has ended, as proc_redirect in tcl/Util.tcl already does.
- 主要言語
- Verilog
- スター
- 658
- フォーク
- 299
- 平均マージ
- 1日 12時間
- マージ済み PR(30日)
- 28
環境構築
このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
The-OpenROAD-Project/OpenSTA のほかの issue
-
get_fanin/get_fanout drop pins of nets with more than one pin対応中かも @dsengupta0628 が 25 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
The-OpenROAD-Project/OpenSTA#457 · 担当者 1 名 ·
メンテナーはふだん 1 日以内に返信
-
get_timing_edges -of_objects returns nested lists and ignores -to対応中かも @dsengupta0628 が 25 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 83/100
The-OpenROAD-Project/OpenSTA#456 · 担当者 1 名 ·
メンテナーはふだん 1 日以内に返信
-
`write_sdf` record order causes a conditional IOPATH delay to be overwritten対応中かも このイシューにリンクされたプルリクエストがオープン中、またはマージ済みです。 オープン
難易度 3/5 1〜2日 初心者へのやさしさ 45/100
The-OpenROAD-Project/OpenSTA#495 ·
メンテナーはふだん 1 日以内に返信
-
難易度 4/5 3〜5日 初心者へのやさしさ 55/100
The-OpenROAD-Project/OpenSTA#477 ·
メンテナーはふだん 1 日以内に返信
-
CRPR: paths, memory and runtime grow faster than the design on large propagated clock networks対応中かも @dsengupta0628 が 25 日前に担当しました。 オープン
難易度 5/5 1週間以上 初心者へのやさしさ 22/100
The-OpenROAD-Project/OpenSTA#452 · 担当者 1 名 ·
メンテナーはふだん 1 日以内に返信
The-OpenROAD-Project/OpenSTA の issue をすべて見る
似ている issue
-
難易度 1/5 1時間未満 初心者へのやさしさ 78/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
ranxianglei/billion-context#8315 ·
メンテナーはふだん 1 日以内に返信
-
XML grammar: only the closing --> of a comment gets the scope comment.block.xml対応中かも @alexeyfala が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
danipen/TextMateSharp#145 · コメント 2 件 ·
-
accepted
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
future-agi/future-agi#6368 ·
メンテナーはふだん 1 日以内に返信
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
omacom/omarchy#21787 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信