Skip to content

Fixed printf bug#57

Merged
blmayer merged 1 commit intoblmayer:mainfrom
maia-woolf:printf-fix
Feb 22, 2026
Merged

Fixed printf bug#57
blmayer merged 1 commit intoblmayer:mainfrom
maia-woolf:printf-fix

Conversation

@maia-woolf
Copy link
Copy Markdown
Contributor

I fixed a bug where % symbols in gemtext are interpreted as printf escape codes, due to the gemtext content being directly inserted into the printf format string. I also removed an unneeded ShellCheck directive.

I can't find in the man pages etc. precisely how arguments work for printf. It appears that -- does what it usually does, in that it says that future arguments should not be treated as option flags, even if they start with -. What I'm not sure about is if arguments that start with -, but occur after the format string, get treated as options by printf. Testing on the printfs I have at hand (BusyBox's sh, GNU coreutils' printf), they seem to not treat arguments after the format string that start with - as options. If this is indeed the standard, universally reliable behaviour, then the -- in the line

printf -- "%s\n" "$line" | fold -w "$width" -s | while IFS='' read -r txt

can be removed. Due to my uncertainty, I haven't done this in this commit.

Fixed bug where % symbols in gemtext are interpreted as printf escape
codes.
Also removed unneeded shellcheck directive.
@blmayer
Copy link
Copy Markdown
Owner

blmayer commented Feb 21, 2026

Will take a look today. Thanks

@blmayer blmayer merged commit a3e5917 into blmayer:main Feb 22, 2026
@blmayer
Copy link
Copy Markdown
Owner

blmayer commented Feb 22, 2026

Thanks!

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