error() in a Lua filter prints ERROR but doesn't stop the render
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 初心者へのやさしさ
- 45/100
- issue の種類
- バグ
- 明瞭さ
- おおむね明確
- 活発さ
- 活発
- 技術スタック
- lua
調査の方向性
Start with src/resources/filters/common/log.lua, where the global error is replaced with a print-only function and the original is kept as builtin_error_function, then check wrapped-filter.lua where user filters receive that environment. Reproduce with stop.lua and a qmd file; done means error() in a user filter exits non-zero like pandoc does, with the existing assert behaviour and Quarto's own logger calls still working.
索引モデルが issue の本文から書いたものです。
説明
I have:
- searched the issue tracker for similar issues
- installed the latest version of Quarto CLI
- formatted my issue following the Bug Reports guide
Bug description
Calling error() in a user Lua filter doesn't stop the render. Quarto prints ERROR (...), writes the output and exits with 0. Plain pandoc stops on the same filter with exit code 83. So a filter that checks a document and calls error() on a problem lets the document through under Quarto.
log.lua replaces the global error with a function that only prints (log.lua#L27-L29), and user filters get that global through their environment (wrapped-filter.lua#L11, #L158). #15226 hit the same root cause from the quarto.json.decode side and keeps the global as it is, since Quarto's own code uses it as a logger, for example wrapped-filter.lua#L200-L201.
So the fix I'd suggest is narrower: give user filters Lua's own error. log.lua already keeps it as builtin_error_function (#L10). Filters that call error() and expect the render to go on would change, so it may need a changelog note. assert() still stops the render (exit 1) and works as a workaround for now.
I can open a PR for this if the approach sounds right.
Steps to reproduce
stop.lua, next to the document:
function Pandoc(doc)
error("stop the render")
end
---
format: html
filters:
- stop.lua
---
Text.
Run quarto render repro.qmd; echo $?.
Actual behavior
ERROR (stop.lua:2) stop the render
Output created: repro.html
The exit code is 0 and repro.html is written.
Expected behavior
The render stops with a non-zero exit code, the way pandoc --lua-filter stop.lua does (exit 83, Error running filter 'stop.lua': stop.lua:2: stop the render) and the way Quarto already does when the filter calls assert(false, "stop the render") (exit 1).
Your environment
- Quarto 1.11.9. The code is the same on main at cda41021442b20964e10e265b9dcdf81f490c18e.
- macOS 15.5 on Apple silicon.
- Rendered from the terminal, no IDE.
Quarto check output
Quarto 1.11.9
[✓] Checking environment information...
Quarto cache location: /Users/test/Library/Caches/quarto
Project: none found (single-file mode)
[✓] Checking versions of quarto binary dependencies...
Pandoc version 3.10.0: OK
Dart Sass version 1.101.0: OK
Deno version 2.9.8: OK
Typst version 0.15.1: OK
[✓] Checking versions of quarto dependencies......OK
[✓] Checking Quarto installation......OK
Version: 1.11.9
Path: /Applications/quarto/bin
[✓] Checking tools....................OK
TinyTeX: (not installed)
Chrome Headless Shell: (not installed)
VeraPDF: (not installed)
[✓] Checking LaTeX....................OK
Using: Installation From Path
Path: /Library/TeX/texbin
Version: 2024
[✓] Checking Chrome Headless....................OK
Using: Chrome found on system
Path: /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
Source: MacOS known location
[✓] Checking basic markdown render....OK
[✓] Checking R installation...........OK
Version: 4.4.1
Path: /Library/Frameworks/R.framework/Resources
LibPaths:
- /Library/Frameworks/R.framework/Versions/4.4-arm64/Resources/library
knitr: 1.49
rmarkdown: 2.29
[✓] Checking Knitr engine render......OK
[✓] Checking Python 3 installation....OK
Version: 3.13.4
Path: /opt/homebrew/opt/[email protected]/bin/python3.13
Jupyter: (None)
Jupyter is not available in this Python installation.
Install with python3 -m pip install jupyter
[✓] Checking Julia installation...
- 主要言語
- JavaScript
- スター
- 6.2k
- フォーク
- 492
- 平均マージ
- 15時間 15分
- マージ済み PR(30日)
- 94
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
quarto-dev/quarto-cli のほかの issue
-
bootstrap enhancement themes
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
quarto-dev/quarto-cli#15421 · コメント 2 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 1/5 1時間未満 初心者へのやさしさ 85/100
quarto-dev/quarto-cli#15408 ·
メンテナーはふだん 1 日以内に返信
-
accessibility bug
難易度 2/5 1〜3時間 初心者へのやさしさ 79/100
quarto-dev/quarto-cli#15401 · リアクション 1 件 ·
メンテナーはふだん 1 日以内に返信
-
bug callouts docx regression
難易度 2/5 1〜3時間 初心者へのやさしさ 81/100
quarto-dev/quarto-cli#15394 · コメント 2 件 ·
メンテナーはふだん 1 日以内に返信
-
bug lightbox
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
quarto-dev/quarto-cli#15393 ·
メンテナーはふだん 1 日以内に返信
quarto-dev/quarto-cli の issue をすべて見る
似ている issue
-
bug help wanted
難易度 2/5 1〜3時間 初心者へのやさしさ 80/100
LangerSword/gitone#7 ·
-
good first issue reliability security should-have
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
メンテナーはふだん 13 日以内に返信
-
[BUG]: chunkSource protocol stripping truncates URLs or reads an inner scheme対応中かも @Bensonbenyi が今日担当しました。 オープン
難易度 1/5 1時間未満 初心者へのやさしさ 88/100
Mintplex-Labs/anything-llm#7338 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
メンテナーはふだん 1 日以内に返信