Ignore detect paths that can't be stat'ed in project detection - #14984
Open
pinin4fjords wants to merge 3 commits into
Open
pinin4fjords wants to merge 3 commits into
pinin4fjords wants to merge 3 commits into
Conversation
existsSync returns true on PermissionDenied, so a parent folder with content/ and a config/ that can't be searched matched the Hugo detect rule config/_default/config.toml although that file doesn't exist. quarto render then wrote Hugo Markdown (even with --output doc.html) or failed walking the folder. Count a detect path only if Deno.statSync succeeds. Real sites are still detected, including when the config file itself is unreadable. Fixes quarto-dev#14983 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Make the detection unit tests table-driven and POSIX-only, add a smoke test that renders with --output doc.html below a config/ at mode 644, and note the stat rule in the project-context architecture doc. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Collaborator
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Fixes #14983.
Project detection currently treats an inaccessible detect path as if it exists. This happens because
safeExistsSync, which wraps@std/fs’sexistsSync, returnstrueforPermissionDenied.As a result, a parent directory containing
content/and an inaccessibleconfig/can incorrectly match Hugo’sconfig/_default/config.tomldetect path, even when that file does not exist.quarto rendermay then:hugo-mdoutput despite--output doc.html; orThis change counts a detect path only when
Deno.statSyncsucceeds. It affects detection only; the input walk still fails on unreadable directories, as intended by #14966.Scope. Quarto resolves documents using absolute paths, so every directory in the upward walk must be searchable. A
_quarto.ymlor single-segment detect path is checked in a searchable directory, so a permission error cannot cause a false match there. Among the bundled extensions, only Hugo’s multi-segment detect path (config/_default/config.toml) is affected.Trade-off. If a Hugo site’s
config/directory cannot be searched, Quarto will no longer detect it as a Hugo site and will render the input as a single file. If only the config file itself is unreadable, the site is still detected (tested on macOS and Linux).Tests. Added unit and smoke tests that fail without this change and pass with it, on macOS and in CI. The following also pass:
tests/unit/projectsmoke/project/project-unreadable-dirchecktests from Fix check crash and raw render error on unreadable project dirs #14966deno fmt --checkdeno lintAdded one sentence describing this rule to
llm-docs/project-context-architecture.md.Checklist
I have (if applicable):
AI-assisted PR
config/can't be entered, soquarto rendercan silently write Markdown #14983 reproduction. The change also went through independent review passes.