Skip to content

Cannot include newline character in output message of advanced_size pattern #3151

@felias-fogg

Description

@felias-fogg

Describe the problem

When including the newline character '\n' in the "output" string of the JSON structure generated by a script called by the recipe.advanced_size.pattern, an error message by the build process is reported. According to the documentation (https://arduino.github.io/arduino-cli/1.1/platform-specification/#recipes-to-compute-binary-sketch-size-for-more-complex-systems-since-arduino-cli-0210), it should be possible to include newline characters in the output string.

To reproduce

I assume you have installed arduino-cli, and you use Linux or macOS.

  1. Install TinyCore manually (see: https://github.com/MCUdude/TinyCore?tab=readme-ov-file#manual-installation).
  2. Load TinyCore/avr/scripts/size.sh into your editor and insert '\n' into the line printf '{ "output": "Flash memory used: %d bytes out of %d (%d%%). ' $flash $maxflash $flashpercent after the full stop.
  3. Create a new sketch: arduino-cli sketch new Blink
  4. Compile: arduino-cli compile -b TinyCore:avr:x5 Blink

Compilation fails:

Used platform Version Path
TinyCore:avr  0.1.0   /Users/nebel/GitHub/TinyCore/avr
Error during build: Error while determining sketch size: invalid character '\n' in string literal

Expected behavior

Successful compilation with a two-line output about RAM and flash size.

Arduino CLI version

arduino-cli Version: nightly-20260405 Commit: da1d3eb Date: 2026-04-05T01:40:13Z

Operating system

macOS

Operating system version

15.7.4

Additional context

No response

Issue checklist

  • I searched for previous reports in the issue tracker
  • I verified the problem still occurs when using the nightly build
  • My report contains all necessary details

Metadata

Metadata

Assignees

No one assigned

    Labels

    topic: build-processRelated to the sketch build processtopic: codeRelated to content of the project itselftype: imperfectionPerceived defect in any part of project

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions