Skip to content

ref-utils: Improve error message intelligibility - #6753

Closed
genodeftest wants to merge 1 commit into
flatpak:mainfrom
genodeftest:patch-1
Closed

genodeftest wants to merge 1 commit into
flatpak:mainfrom
genodeftest:patch-1

Conversation

@genodeftest

Copy link
Copy Markdown

Solves a problem where flatpak would print a non-helpful error message if the disallowed character is a space or other whitespace character.

Solves a problem where flatpak would print a non-helpful error message if the disallowed character is a space.
@genodeftest

genodeftest commented Aug 5, 2026 •

Copy link
Copy Markdown
Author

Example problem: I ran $ flatpak info "Clapper Enhancers" because I didn't remember that I need to put an ID as argument for flatpak info. As result, I got error: Invalid id Clapper Enhancers: Name can't contain and was confused whether flatpak stopped printing text mid-sentence, until I understood that this message want to tell me that flatpak IDs cannot contain the space character.

else
flatpak_fail_error (error, FLATPAK_ERROR_INVALID_NAME,
_("Name can't contain %c"), *s);
_("Name can't contain »%c«"), *s);

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.

Isn't that usually just normal quotes: "Name can't contain \"%c\""?

Also the commit message should have a prefix and be a bit more specific: ref-utils: Improve error message in flatpak_is_valid_name

@swick

swick commented Aug 21, 2026

Copy link
Copy Markdown
Collaborator

@genodeftest ping

@smcv

smcv commented Aug 21, 2026

Copy link
Copy Markdown
Collaborator

There is a more general issue here, which is that if we log %c, in general that's going to cut off the first byte of UTF-8 output, leading to corrupting our output by emitting non-UTF-8 (for example this was the root cause for #6768). And, logging %c can mess up display in other ways if it's a control character.

I'm trying to fix this more generally, resolving the technical debt from #6768.

@smcv

smcv commented Aug 21, 2026

Copy link
Copy Markdown
Collaborator

I'm trying to fix this more generally, resolving the technical debt from #6768.

I have a branch for this, but I'm unable to push to Github right now - I'll try again later and see whether their servers have sorted themselves out.

@smcv smcv mentioned this pull request Aug 21, 2026
@smcv

smcv commented Aug 21, 2026

Copy link
Copy Markdown
Collaborator

I'm trying to fix this more generally, resolving the technical debt from #6768.

Try this: #6795

smcv added a commit to smcv/flatpak that referenced this pull request Aug 21, 2026
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]>
@swick

swick commented Aug 21, 2026

Copy link
Copy Markdown
Collaborator

Closing in favor of #6795. Thanks @genodeftest.

@swick swick closed this Aug 21, 2026
smcv added a commit to smcv/flatpak that referenced this pull request Aug 21, 2026
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]>
pull Bot pushed a commit to lyncsyncsafe/e that referenced this pull request Aug 21, 2026
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]>
@genodeftest
genodeftest deleted the patch-1 branch August 22, 2026 10:00
@genodeftest

Copy link
Copy Markdown
Author

Thanks for taking care and providing a better fix!

I'm sorry I didn't respond earlier, I was on the roads and didn't find time to do this properly.

swick pushed a commit that referenced this pull request Aug 27, 2026
While I'm changing the translatable string anyway, this also
incorporates a suggestion from #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]>
Cherry-picked-from: 5f3f7a8
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.

3 participants