-
-
Notifications
You must be signed in to change notification settings - Fork 406
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
GPG signature verification fails incorrectly for commits with empty message #1429
Comments
Tests for signatures should probably just live in dulwich.objects, probably as a separate testcase that calls skipTest in its setUp() if the gpg module is not present. |
I've got a nice clean reproduction case for this issue based on the unit test case I just added for PR #1438. STEPS: From PR #1438, inside tests/compat/test_porcelain.py CommitCreateSignTestCase.test_verify, change the message string RESULT: |
* Fixes incorrect signature verification for commits with an empty message, as encoded by CGit (jelmer#1429)
* Fixes incorrect signature verification for commits with an empty message, as encoded by CGit (jelmer#1429)
* Fixes incorrect signature verification for commits with an empty message, as encoded by CGit (jelmer#1429)
* Fixes incorrect signature verification for commits with an empty message, as encoded by CGit (jelmer#1429)
Fixes #1429, incorrect signature verification for commits with an empty message, as encoded by CGit.
I've hit this problem in my messy dev environment. I figure I should make a PR for a nice clean repo case as a unit test. Do you have a recommendation on where commit signature verification test cases should go?
An example of a GPG signed commit that I am 95% sure will fail incorrectly is this one:
https://archive.softwareheritage.org/api/1/revision/92b3f55bcec30906a39796c90018475bc1cbabb7/
I think the problem is the calling of
_format_message
with an argument ofself._message
to the body parameter:dulwich/dulwich/objects.py
Line 1576 in e7e83d6
When the commit message is empty, I believe this causes the newline on this line:
dulwich/dulwich/objects.py
Line 730 in e7e83d6
that is inside the if statement (instead of above it) to not get output (when it should). But when a signature-less commit is generated on this line:
dulwich/dulwich/objects.py
Line 1531 in e7e83d6
the GPG signature verification will fail when the commit has an empty commit message, because a newline will be missing at the end.
The text was updated successfully, but these errors were encountered: