Skip to content

Check each tool entry's quoting during validation (#699) - #1412

Merged
mkarlesky merged 4 commits into
masterfrom
fix/1.2.3-tool-quoting
Nov 13, 2026
Merged

mkarlesky merged 4 commits into
masterfrom
fix/1.2.3-tool-quoting

Conversation

@mkarlesky

Copy link
Copy Markdown
Member

Closes #699.

Problem

A tool's command reaches the shell as one string. A quote that one :executable or :arguments entry leaves open pairs with a quote in a later entry, so the command's words shift. The usual cause is a typographic quote pasted from a web page, as in -I"${5}”. A shell reads ” as an ordinary character.

  • Odd count: POSIX sh fails with a syntax error, and on Windows the rest of the command, source file included, is swallowed into one argument. Using custom compiler settings not working #699's gcc reported no input files.
  • Even count: the build runs with silently corrupted paths.

Nothing checked a tool's quoting before this change.

Change

  • Where the check lives: ToolValidator. ConfiguratorValidator only fetches core :tools and hands them on. Every plugin tool, Command Hooks included, calls ToolValidator directly, so every tool gets the check with no new call sites.
  • Errors: an unclosed quote fails validation and names the entry. Any typographic quote in that entry is named as the likely cause:
    🪲 ERROR: :tools ↳ :test_compiler ↳ :arguments ➡️ `-I"${5}”` leaves a " quote unclosed. Enclose the argument with " quotes. It holds ”, a typographic quote that a shell treats as an ordinary character. Replace it with ".
    
  • Warnings: a typographic quote inside quoting that closes only warns, since it may be meant literally.
  • Per entry: each entry must close its own quotes, so a quoted value can't span two entries. This is listed in Breaking Changes.
  • Coverage: optional tools are checked too. An unclosed executable reports once, without a second "does not exist" error.
  • ShellQuoting reads one entry as a shell does. A backslash escapes the next character outside single quotes, and Ruby #{…} expansions are skipped. On Windows, ' is an ordinary character.
  • ToolQuoting walks the entries as ToolExecutor expands them: string arguments, plus each hash argument's first key and the strings among its values.
  • Reorganization: the first commit moves tool_executor.rb, tool_executor_helper.rb and tool_validator.rb into lib/ceedling/tools/, and their unit specs into spec/units/tools/. Only require paths change.

Verification

  • All unit and integration specs pass (7,032 examples), and RuboCop is clean. Regenerating the to-do changes nothing.
  • A guard spec runs all 50 built-in core and plugin tools through validation, on Windows and elsewhere, and finds no errors and no warnings. It fails on an injected bad tool and on an injected warning.
  • Deliberately broken versions of the scanner and the entry walk fail the new specs.
  • On an example project, Using custom compiler settings not working #699's argument fails at configuration with the error above, and a curly-quote-only argument warns. Two unmodified examples build with no new warnings.

🤖 Generated with Claude Code

mkarlesky and others added 3 commits November 13, 2026 00:09
ToolExecutor, ToolExecutorHelper and ToolValidator move to their own
directory, as the file code did in filesystem/. Their unit specs move to
spec/units/tools/ alongside the default tools' quoting spec. Only require
paths change. DIY finds the objects through the load path the rakefile
already builds from every lib/ceedling/ subdirectory.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A tool's command reaches the shell as one string. A quote that one entry
leaves open pairs with a quote in a later entry, so the command's words
shift. A typographic quote pasted from a web page is the usual cause,
since a shell reads it as an ordinary character. The build then fails
with an unrelated error such as `no input files`, or runs with corrupted
paths.

ToolValidator now checks :executable and every argument, hash arguments
included, as each tool validates. ShellQuoting reads one entry as a
shell does. A backslash escapes outside single quotes, and on Windows a
single quote is ordinary. ToolQuoting walks a tool's entries and words
the findings. An unclosed quote fails validation and names the entry,
along with any typographic quote as its likely cause. A typographic
quote in closed quoting only warns. An executable left unclosed skips
the search for its file, so it reports once. Optional tools are checked
too.

Every built-in core and plugin tool passes with no finding, on Windows
and elsewhere.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The tools reference notes that each argument closes its own quotes and
that a typographic quote draws a warning. The Changelog lists the check
under 1.2.3's additions. Breaking Changes describes a quote that spans
two arguments, which now fails validation.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions

github-actions Bot commented Nov 13, 2026 •

Copy link
Copy Markdown

CI summary · 2bf5de7 · ✅ 25/25 jobs passed · nearest baseline bf3683b (master)

Tests (Linux 3.3) Examples Failures Pending
units 6228 (+85) 0 0
integration 804 (+35) 0 17
system 425 (+4) 0 37
Coverage Lines Δ
units 91.50% ▲0.02
integration 55.99% ▲0.56
system 84.69% ▲0.10
combined 98.62% ▲0.02

Diff coverage: 100.00% (54/54 changed lines).

RuboCop to-do Count Δ
offenses 678 ▼15
cops 10 ±0
All legs (examples / failures / pending)
Leg units integration system
Linux 3.0 6228 / 0 / 0 804 / 0 / 17 425 / 0 / 37
Linux 3.1 6228 / 0 / 0 804 / 0 / 17 425 / 0 / 37
Linux 3.2 6228 / 0 / 0 804 / 0 / 17 425 / 0 / 37
Linux 3.3 6228 / 0 / 0 804 / 0 / 17 425 / 0 / 37
Linux 3.4 6228 / 0 / 0 804 / 0 / 17 425 / 0 / 37
Linux 3.5 6228 / 0 / 0 804 / 0 / 17 425 / 0 / 37
Windows 3.0 6226 / 0 / 2 807 / 0 / 17 425 / 0 / 64
Windows 3.1 6226 / 0 / 2 807 / 0 / 17 425 / 0 / 64
Windows 3.2 6226 / 0 / 2 807 / 0 / 17 425 / 0 / 64
Windows 3.3 6226 / 0 / 2 807 / 0 / 17 425 / 0 / 64
Windows 3.4 6226 / 0 / 2 807 / 0 / 17 425 / 0 / 64
macOS 3.1 6228 / 0 / 0 804 / 0 / 18 425 / 0 / 53
macOS 3.2 6228 / 0 / 0 804 / 0 / 18 425 / 0 / 53
macOS 3.3 6228 / 0 / 0 804 / 0 / 18 425 / 0 / 53
macOS 3.4 6228 / 0 / 0 804 / 0 / 18 425 / 0 / 53
macOS 3.5 6228 / 0 / 0 804 / 0 / 18 425 / 0 / 53
Jobs

The quoting guard spec labeled each plugin YAML tool with
File.dirname( path, 2 ). The level argument arrived in Ruby 3.1, so the
spec failed to load on the Ruby 3.0 CI jobs. Nested dirname calls give
the same label on every supported Ruby.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@mkarlesky
mkarlesky merged commit 814e363 into master Nov 13, 2026
26 checks passed
@mkarlesky
mkarlesky deleted the fix/1.2.3-tool-quoting branch November 13, 2026 13:32
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.

Using custom compiler settings not working

1 participant