Skip to content

talosctl edit machineconfig duplicates line endings when saving a CRLF file #12664

@DavidBeh

Description

@DavidBeh

Bug Report

When using talosctl edit machineconfig, newlines will be duplicated, if they use CLRF. The command creates the file with those line endings on windows.

To prevent duplicate newlines, I have to manually use "change end of line sequence" in VSCode everytime when using the command.

Reproduce:

Powershell on Windows

$env:TALOS_EDITOR = 'code -w' #wait for exit/closing vscode tab
talosctl edit machineconfig # specify -n as required
# The status line of the opened file should show CLRF
# Now close the vscode tab/window
talosctl edit machineconfig # check again
# Every newline is now duplicated compared to last time.
# Modify the file in any way (e.g. add a yaml comment)
# Convert to LF using the "change end of line sequence" in VSCode
# Make sure to save the file, then close the vscode tab/window
talosctl edit machineconfig
# This time the file should look like how it was saved last time.

Some more notes:

  • When running talosctl edit machineconfig and then exiting the editor, talos will detect the file as having changed.
  • When running talosctl edit machineconfig and only converting the line endings to LF, talos will detect the file as not having been changed.

I have not (yet) tested, if this affects talosctl apply-config

Environment

  • Talosctl version: v1.12.1
  • Platform (Client): Windows

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions