Skip to content

Leading newline in multiline upload_port breaks device monitor port resolution #5552

Backlog

Description

@NicHub
  • PlatformIO Core

Configuration

  • Operating system: macOS 26.6 (arm64)
  • PlatformIO Core: 6.2.0

Steps to reproduce

Create a platformio.ini with a single serial port specified on an indented continuation line:

[env]
monitor_port = ${this.upload_port}

[env:rx]
platform = espressif32
board = seeed_xiao_esp32s3
framework = arduino
upload_port =
    /dev/cu.usbmodem201301
    ; /dev/cu.usbmodem2011101
  1. Run pio project config --json-output. No hardware is required for this step.
  2. To see the runtime failure, substitute a connected device's serial port and run pio device monitor -e rx directly in an interactive terminal, without a pipe.

Actual results

The resolved upload_port and monitor_port values both contain a leading newline ("\n/dev/cu.usbmodem201301"). The monitor passes that string to pySerial and fails to open the port with No such file or directory, even though the device exists. Stating the same value on the assignment line (upload_port = /dev/cu.usbmodem201301) works.

Expected results

For these single-value serial port options, ignore surrounding whitespace after resolving the INI value and interpolation. The indented form with one port should resolve to the same path as the inline form. This would preserve the behavior of other multiline options.

Additional information

Python's ConfigParser accepts the continuation syntax and preserves the leading newline.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions