From 2c5cbbb954510e46b9d1f39b57a554f7edd5b7c5 Mon Sep 17 00:00:00 2001 From: Oliver Smith Date: Mon, 9 Jul 2018 22:53:34 +0200 Subject: [PATCH] Don't allow trailing comma in additional packages Prior to this commit, it was possible to type in packages with a trailing comma in `pmbootstrap init` when asked for extra packages. This leads to problems during `pmbootstrap install`, so now we disallow it. Fixes #1540. --- pmb/config/init.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/pmb/config/init.py b/pmb/config/init.py index f6383839..43ee0a41 100644 --- a/pmb/config/init.py +++ b/pmb/config/init.py @@ -337,9 +337,10 @@ def frontend(args): logging.info("Additional packages that will be installed to rootfs." " Specify them in a comma separated list (e.g.: vim,file)" " or \"none\"") - cfg["pmbootstrap"]["extra_packages"] = pmb.helpers.cli.ask(args, "Extra packages", - None, args.extra_packages, - validation_regex="^(|[-.+\w\s]+(?:,[-.+\w\s]*)*)$") + extra = pmb.helpers.cli.ask(args, "Extra packages", None, + args.extra_packages, + validation_regex="^([\w-]+)(,[\w-]+)*$") + cfg["pmbootstrap"]["extra_packages"] = extra # Configure timezone info cfg["pmbootstrap"]["timezone"] = ask_for_timezone(args)