Skip to content
Snippets Groups Projects
Commit beebe3fd authored by Zbigniew Jędrzejewski-Szmek's avatar Zbigniew Jędrzejewski-Szmek Committed by Chris Lamb
Browse files

comparators: improve extraction of ssh version

E.g. Fedora has "OpenSSH_8.7p1, OpenSSL 1.1.1l  FIPS 24 Aug 2021", which
would give "8.7p1," as the version.
parent fef2375b
No related branches found
No related tags found
1 merge request!87Stop using deprecated distutils
......@@ -19,6 +19,7 @@
import pytest
import subprocess
import re
from diffoscope.config import Config
from diffoscope.comparators.openssh import PublicKeyFile
......@@ -36,7 +37,7 @@ opensshpubkey2 = load_fixture("test_openssh_pub_key2.pub")
def openssh_version():
out = subprocess.check_output(("ssh", "-V"), stderr=subprocess.STDOUT)
return out.decode().split()[0].split("_")[1]
return re.match(r"OpenSSH_([a-zA-Z0-9._+-]+)", out.decode()).group(1)
def test_identification(opensshpubkey1):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment