Skip to content

Avoid %c in error messages - #6795

Merged
smcv merged 5 commits into
flatpak:mainfrom
smcv:validation-errors
Aug 21, 2026
Merged

smcv merged 5 commits into
flatpak:mainfrom
smcv:validation-errors

Conversation

@smcv

@smcv smcv commented Aug 21, 2026

Copy link
Copy Markdown
Collaborator
  • utils: Add a function to describe invalid characters in strings

    Until now we have been using %c to show invalid characters, but in
    general that will corrupt our output if the input is non-ASCII,
    because the individual bytes of a UTF-8 string are not valid UTF-8 alone.

  • utils: Avoid corrupting our output if an invalid glob is not UTF-8

  • po: Update translations for "Invalid glob character" where obvious

  • ref-utils: Always produce valid UTF-8 in validation error messages

    While I'm changing the translatable string anyway, this also
    incorporates a suggestion from ref-utils: Improve error message intelligibility #6753 to quote the invalid character, so
    that output is clearer in the case where the invalid character is
    whitespace.

    Thanks: Christian Stadelmann

  • Revert "tests: Avoid Meson's strict TAP parsing for now"

    Now that our error messages are valid UTF-8, we should no longer need to
    do this.

    This reverts commit 242e989.

@swick swick left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Comment thread common/flatpak-utils-private.h Outdated
smcv added 5 commits August 21, 2026 16:57
Until now we have been using `%c` to show invalid characters, but in
general that will corrupt our output if the input is non-ASCII,
because the individual bytes of a UTF-8 string are not valid UTF-8 alone.

Signed-off-by: Simon McVittie <[email protected]>
While I'm changing the translatable string anyway, this also
incorporates a suggestion from flatpak#6753 to quote the invalid character, so
that output is clearer in the case where the invalid character is
whitespace.

Thanks: Christian Stadelmann
Signed-off-by: Simon McVittie <[email protected]>
Now that our error messages are valid UTF-8, we should no longer need to
do this.

This reverts commit 242e989.

Signed-off-by: Simon McVittie <[email protected]>
@smcv
smcv force-pushed the validation-errors branch from 45d78f2 to 4edc45c Compare August 21, 2026 16:00
@smcv
smcv requested a review from swick August 21, 2026 16:00
@smcv
smcv added this pull request to the merge queue Aug 21, 2026
Merged via the queue into flatpak:main with commit 86d10f5 Aug 21, 2026
11 checks passed
@smcv
smcv deleted the validation-errors branch August 21, 2026 16:17
@swick swick mentioned this pull request Aug 27, 2026
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.

2 participants