Skip to content

Signed commits not parsed correctly #132

Closed
@ArnoVanLumig

Description

@ArnoVanLumig

The _deserialize method of the Commit object (objects/commit.py:407) doesn't handle signed commits properly, see this example of a raw formatted git commit object (taken from the rails repository, where I discovered this bug):

commit 31735bd39127784019893e4860b2c9807293da25
tree 9c028a6346b49abfed31d8927d47980994f3b73d
parent 1f633c78ea7ff13a8f35d64e8172b774dd662667
author Miguel Herranz <[email protected]> 1345231220 +0200
committer Miguel Herranz <[email protected]> 1345231220 +0200
gpgsig -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1.4.12 (Darwin)

 iQIcBAABAgAGBQJQLpm/AAoJEJPQ5hNIfbMZ5KAP/2lFh7WMNR8c1tyQOXW518/k
 92mr1YsdD4dSePLflKvloZe6ITfb6btcSd/nAnbdBubRiuqlpCGSmMUzZrafNXpF
 WD5zAPQude75KJl3Rar6nBCLzpNm4a3sAQdLvDLgjCA823+qAzLbk7xWCt+0oaal
 qJK5SJDwtyF+PXS8T+WPhuIERjNE3CkPG7NCFR4Atg1aiSMBkfY35FS0JpSXNqW0
 VZcHjAZR8oC7YuipwkoEKatjC/lwQfRKM+LdI2qP/1f05EVJaDAZGpQShyrVNgLt
 hlaZLL880XyNdzuP986J19RbuG69+GWbL2Q0DZItrxbUo7JqDes0uIDh/c2xlwDt
 QFISJ9Xieogo2FKDIFD2rc8jiHYiMx3OUs6QOTz6YXfAUdEoVInrv32Tm0E+IiHq
 Y5xxlBiNOsHd448Om6cB7sliwbdc5ic9UYrWibqgzEjdiyoY3uRnyS6r19ISjod+
 +C5aYZr3uWz7xzW6hY+VWi9pM9xxkdYZEN1vBiGrm3hH9b2cm9M1roRrMoCz0Kjy
 xgZSSnp+Dft2Sw61DJHxf7t8oaOW7J7ZWjkD6mM66Kx7IpKzvzfReSYjLQtQNcNt
 8NHVUySPkC3/gpdlyzGOSu0xRvH1eq2eBJrKetlNN9XAEZAutQ+symdmfNY7L/Mj
 JcwMU0pcsI9X8NXBUMoK
 =GOBp
 -----END PGP SIGNATURE-----

    Update to activerecord-deprecated_finders on generator

As you see there may be a gpgsig line after the committer which is then followed by the actual signature. GitPython doesn't recognise this and will interpret it as the encoding line. The enc variable is then set to '-----BEGIN PGP SIGNATURE-----', which is of course not valid and will cause an exception on line 443.

To reproduce the problem first clone the rails repository, and then run this code:

from git import *
repo = Repo("../rails")
repo.commit("31735bd39127784019893e4860b2c9807293da25").author

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions