A git sign bug
While working on the new git signing feature for
tumpa-cli I noticed that some of
the commits can not be verified. For a moment I freaked out and then thought it
must be a problem in my code. But, I could not dig enough. Opus 4.7 helped me
to find the eaxct commit in git's history and a reproducer. I reported the issue to the
maintainers
and they are working on a fix.
\xc2\xa7 aka § was the cause for me.
| msg.txt body | sign stdin (tee'd) | stored commit body | verify | |
|---|---|---|---|---|
| git 2.43 (host) | ... 20 a7 0a | ... 20 c2 a7 0a | ... 20 c2 a7 0a | OK |
| git 2.53 (CI, docker) | ... 20 a7 0a | ... 20 a7 0a | ... 20 c2 a7 0a | BAD |
git 2.43 transcoded the message to UTF-8 BEFORE calling the signer;
signer and storage saw the same bytes (c2 a7). git 2.53 hands the
signer the RAW bytes (a7) and transcodes only on the way to the
commit object (c2 a7). The invariant "bytes fed to gpg.program at
sign time equal the bytes a verifier sees when it reads the commit
back" is broken.
git config i18n.commitEncoding iso-8859-1 is supposed to be the configuration
if we have non UTF-8 characters. But, I never knew about this configuration
before I found the bug.
I want to thank my friends in Anthropic for letting me use the tools and techonology to keep building.






