Skip to content

Commit

Permalink
virtme-ng: more robust parsing of upstream versions
Browse files Browse the repository at this point in the history
Checking if the target of `--run` begins with 'v' to determine if we
need to run a pre-compiled upstream kernel is a bit too weak.

For example we may incorrectly interpret files starting with 'v' as
versions.

Prevent this by using a proper regex to match for target versions.

Signed-off-by: Andrea Righi <[email protected]>
  • Loading branch information
Andrea Righi committed Feb 22, 2024
1 parent 58e1033 commit c164a3a
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion virtme_ng/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"""virtme-ng: main command-line frontend."""

import argparse
import re
import os
import sys
import socket
Expand Down Expand Up @@ -800,7 +801,7 @@ def _get_virtme_run(self, args):
# If an upstream version is specified (using an upstream tag) fetch
# and run the corresponding kernel from the Ubuntu mainline
# repository.
if args.run.startswith('v'):
if re.match(r'^v\d+(\.\d+)*$', args.run):
if args.arch is None:
arch = 'amd64'
else:
Expand Down

0 comments on commit c164a3a

Please sign in to comment.