fortra / impacket

Impacket is a collection of Python classes for working with network protocols.
https://www.coresecurity.com
Other
13.37k stars 3.56k forks source link

Signed commits break building and installing from git repo if `log.showSignature=true` in git #1756

Open AdrianVollmer opened 4 months ago

AdrianVollmer commented 4 months ago

You recently started to sign commits, which is great. However, it breaks constructing the version number in setup.py. When someone has set log.showSignature=true in git, building and installing impacket from sources fails.

Configuration

impacket version: 15eff88 Python version: 3.7.3 (but affects all) Target OS: Debian Sid

Debug Output With Command String

$ git clone https://github.com/fortra/impacket.git
$ cd impacket
$ python3 setup.py --version
/usr/lib/python3/dist-packages/setuptools/dist.py:475: UserWarning: Normalizing '0.12.0.dev1+20240523.075507.15eff880' to '0.12.0.dev1+20240523.75507.15eff880'
  normalized_version,
0.12.0.dev1+20240523.75507.15eff880
$ git config log.showSignature true
$ python3 setup.py --version
/usr/lib/python3/dist-packages/setuptools/dist.py:484: UserWarning: The version specified ("0.12.0.dev1+gpg: Signature made Thu May 23 10:55:08 2024 UTC\ngpg:                using RSA key B5690EEEBB952194\ngpg: Can't check signature: No public key\n20240523.075507.15eff880") is an invalid version, this may not work as expected with newer versions of setuptools, pip, and PyPI. Please see PEP 440 for more details.
  "details." % self.metadata.version
0.12.0.dev1+gpg: Signature made Thu May 23 10:55:08 2024 UTC
gpg:                using RSA key B5690EEEBB952194
gpg: Can't check signature: No public key
20240523.075507.15eff880

Additional context

If you're parsing git output, you should use the last line. An even better solution would be to use a modern build system such as hatch.