Skip to content

Fix dev quarto.cmd when the checkout path contains a space - #15276

Merged
cderv merged 1 commit into
mainfrom
fix/dev-quarto-cmd-path-with-spaces
Nov 4, 2026
Merged

cderv merged 1 commit into
mainfrom
fix/dev-quarto-cmd-path-with-spaces

Conversation

@cderv

@cderv cderv commented Nov 3, 2026

Copy link
Copy Markdown
Member

With a quarto-cli checkout under a path containing a space, the dev quarto.cmd on Windows fails before running anything. It prints 'C:\path\with' is not recognized as an internal or external command, reports that Quarto requires reconfiguration to install Deno with an empty version, and exits. Every later run does the same. It also overwrites package/dist/config/deno-version with the localized "ECHO is off." text, which stays behind after moving the checkout back to a normal path.

Found while testing the launcher change from #15259 through a directory junction with a space in its name. The problem predates #15259, which added one more instance of it.

Root cause

Several paths in the dev mode branch of package/scripts/windows/quarto.cmd reach cmd or Deno unquoted:

  1. call !QUARTO_ROOT!\win_configuration.bat is split at the space, so the script that sets DENO and the other dependency versions never runs. With DENO empty, the stale Deno check sees a version mismatch, writes the empty value to deno-version (that is the "ECHO is off." text) and asks to retry.
  2. The final launch line passes the Deno executable and src/quarto.ts unquoted.
  3. --importmap and --lock wrap their path in doubled quotes (--importmap=""path""), which Deno receives as an unquoted path. The import map argument used single quotes before the conda support changes (conda plumbing #1687, Restore conda with dev mode fix #2015), and the --lock argument from Add Deno lockfile #15259 copied the doubled form.

Fix

Quote the call and the paths on the launch line, and use single inner quotes for --importmap and --lock. The cd in the stale Deno branch is quoted for consistency only, as cd already accepts an unquoted path with spaces.

The bundled (non-dev) branch is unchanged. Installed Quarto runs through quarto.exe, which works from such a path, but the quarto.cmd shipped next to it has the same unquoted launch line and is not covered here.

The new unit test runs quarto.cmd through a junction whose name contains a space and checks that it succeeds and that deno-version still holds the configured Deno version. It is Windows only and skipped in binary mode.

Checklist

I have (if applicable):

  • referenced the GitHub issue this PR closes
  • updated the appropriate changelog in the PR
  • ensured the present test suite passes
  • added new tests
  • created a separate documentation PR in Quarto's website repo and linked it to this PR
AI-assisted PR
  • AI tool used: Claude Code
  • Codebase grounding: local clone
  • Human review: I have reviewed, tested, and verified the AI-generated content before submitting.

Note: autonomous AI agents submitting PRs without human oversight are not permitted — see the Code of Conduct.

…aces

In dev mode the launcher called win_configuration.bat unquoted, so cmd
split the checkout path at the first space and DENO stayed empty. The
stale-Deno check then fired on every run: it overwrote
config/deno-version with the localized "ECHO is off." text and asked the
user to retry, and the corrupted file stayed behind afterwards.

Quoting that call exposed two more breaks further down the same path:
the final launch line passed the deno executable and quarto.ts unquoted,
and QUARTO_IMPORT_MAP_ARG wrapped the import map path in doubled quotes,
which Deno parses as an unquoted path. The import map argument goes back
to single inner quotes, the form it had before the conda plumbing change
switched it to the doubled form without a stated reason. The --lock
argument added with the Deno lockfile copied the doubled form and fails
the same way, so it gets single inner quotes too. The `cd` in the
stale-Deno branch is quoted for consistency, although `cd` already
accepts an unquoted path with spaces.

The bundled branch of the launcher is left unchanged; quarto.exe is the
entry point there.

The test runs quarto.cmd through a junction whose name contains a space
and checks that config/deno-version still holds the configured Deno
version. It disables current-directory command lookup for the child so
that a regression reaching the stale-Deno branch cannot run
configure.cmd against the checkout under test.
@posit-snyk-bot

posit-snyk-bot commented Nov 3, 2026 •

Copy link
Copy Markdown
Collaborator

✅ Snyk checks have passed. No issues have been found so far.

Status Scan Engine Critical High Medium Low Total (0)
✅ Open Source Security 0 0 0 0 0 issues
✅ Licenses 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

@cderv
cderv merged commit a38795c into main Nov 4, 2026
52 checks passed
@cderv
cderv deleted the fix/dev-quarto-cmd-path-with-spaces branch November 4, 2026 11:31
cderv added a commit that referenced this pull request Nov 4, 2026
The Windows installers ship quarto.cmd next to quarto.exe. Its bundled
launch line passed the Deno executable and quarto.js unquoted, so when
the install path contained a space, Deno re-parsed the raw command line,
took the rest of its own path as the script, and failed before Quarto
started. quarto.exe was not affected.

- Quote the Deno executable and quarto.js on the bundled launch line,
  matching the dev launch line.
- Remove QUARTO_IMPORT_MAP_ARG from the bundled branch. It has not been
  passed to Deno since quarto.cmd was aligned with the POSIX quarto
  script, and quarto.js is a self-contained bundle.
- Add a Windows-only test that runs quarto.cmd from a bundled layout
  under a directory with a space and checks that it runs quarto.js with
  its arguments.

See #15276, which fixed the same problem in the dev branch.
cderv added a commit that referenced this pull request Nov 13, 2026
Plan 33 Task 9 Step 4 replaces quarto.cmd with a full listing written
before #15276 and this fix. Pasted as is, it would bring back the
argument corruption, the "%1" shortcuts and the unquoted
win_configuration.bat call. Per the migration AGENTS.md, the finding
goes in the open-decisions table for PR 33's step 0, not into the plan.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants