Multiline config export can create files missing blank line at EOF

Created on 30 September 2021, over 3 years ago
Updated 7 June 2024, 7 months ago

Problem/Motivation

When configuration is exported, if the last item that is exported is a multiline value the file will not end with a blank line. This causes problems with code validation tools that expect a blank line at the end of the file, e.g. Coder.

Steps to reproduce

Export a configuration item that has a multiline string at the end of the file, e.g. a block definition with visibility rules that has multiple paths entered.

Proposed resolution

Have the configuration system verify that there's a blank line at the end of each file prior to exporting.

Possible workaround is to use the multiline_config β†’ module.

Remaining tasks

Provide a patch to fix the error.

User interface changes

n/a

API changes

n/a

Data model changes

n/a

Release notes snippet

TBD

πŸ› Bug report
Status

Active

Version

11.0 πŸ”₯

Component
ConfigurationΒ  β†’

Last updated about 17 hours ago

Created by

πŸ‡ΊπŸ‡ΈUnited States DamienMcKenna NH, USA

Live updates comments and jobs are added and updated live.
  • Needs tests

    The change is currently missing an automated test that fails when run with the original code, and succeeds when the bug has been fixed.

Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • πŸ‡¬πŸ‡§United Kingdom AaronMcHale Edinburgh, Scotland

    Does anyone have a quick fix for this? It's mildly annoying to have to go through each file and manually add a new line after every config export.

    Thanks.

  • πŸ‡ΊπŸ‡ΈUnited States DamienMcKenna NH, USA

    I've been using multiline_config to work around the problem.

  • πŸ‡¬πŸ‡§United Kingdom AaronMcHale Edinburgh, Scotland

    @DamienMcKenna thanks, does multiline_config actually have any effect in 9.3 onwards? The project page states that the module is no longer needed in 9.3+, yet obviously the issue of no new line at the end of a file is still a problem, so maybe I'm missing something?

  • πŸ‡ΊπŸ‡ΈUnited States DamienMcKenna NH, USA

    It's not technically needed, but it still works and can work around this core bug.

  • πŸ‡¬πŸ‡§United Kingdom AaronMcHale Edinburgh, Scotland

    Awesome, will give it a try!

  • πŸ‡ΊπŸ‡ΈUnited States jrearick Iowa

    We are affected by this as well. Our linters are calling this out as an error. In our example, we're seeing this in `webform.webform_options.foo.yml` where the `options` key is the last one and multiline. Our workaround was to add extra line breaks in the webform yml editing UI.

Production build 0.71.5 2024