Repository navigation
setup: keep gpg output out of the version string - #2356
Merged
Merged
Conversation
The version suffix is built from a single git call:
p = Popen("git log -1 --format=%cd --date=format:%Y%m%d.%H%M%S", ...)
(VER_CDATE, VER_CTIME) = outstr.strip().decode("utf-8").split('.')
With `log.showSignature=true` in the user's git config -- the setting
impacket's own signed commits invite -- git prepends the signature
verification to stdout, so the value no longer splits into two parts and
the unpack raises. The exception is swallowed by the surrounding `except`,
leaving VER_LOCAL empty, and the package is built as `0.14.0.dev0` with no
commit information at all.
Ask git not to show the signature for this call. The dates are unaffected
and `--no-show-signature` wins over the config setting, so the suffix comes
out the same whatever the user has configured.
Verified against a signed commit with `log.showSignature=true`:
before: 0.14.0.dev0
after: 0.14.0.dev0+20261103.140904.ca67ba7
With the setting false or absent the value is unchanged:
`0.14.0.dev0+20261103.140904.ca67ba7` both before and after.
Fixes fortra#1756
godylockz
pushed a commit
to godylockz/impacket
that referenced
this pull request
Nov 22, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this fixes
The version suffix is built from a single git call:
With
log.showSignature=truein the user's git config — a setting impacket's own signed commitsinvite — git writes the signature verification to stdout before the date:
The value no longer splits into two parts, the unpack raises, and the surrounding
exceptswallows it.
VER_LOCALstays empty and the package is built as0.14.0.dev0— no commit date, nohash.
Fixes #1756.
The change
One flag.
--no-show-signaturetakes precedence overlog.showSignature, so the output is thedate and nothing else regardless of what the user has configured, and no other git invocation in
setup.pyis affected.Verification
I generated a throwaway GPG key, signed a commit, and set
log.showSignature=true, then ranpython3 setup.py --versionon the same commit:log.showSignaturetrue0.14.0.dev00.14.0.dev0+20261103.140904.ca67ba7false0.14.0.dev0+20261103.140904.ca67ba70.14.0.dev0+20261103.140904.ca67ba70.14.0.dev0+20261103.140904.ca67ba70.14.0.dev0+20261103.140904.ca67ba7Only the broken combination changes. The intermediate value, confirming the diagnosis:
The test key and the signed commit were removed afterwards; nothing in the branch depends on them.
Note
This is my second PR here — #2355 (SMB2 share types) is unrelated and still open. Both are
one-bug fixes with a reproduction in the description; say the word if you would rather I space them
out.