From 5d9e2e7e23bf0b5926f1681bc3991632fe0140a7 Mon Sep 17 00:00:00 2001 From: Stefan Huber Date: Wed, 23 May 2012 08:42:21 +0200 Subject: [PATCH] set and epoch's name must comprise alphanum chars --- sitarba | 9 +++++++++ sitarba.conf | 6 ++++-- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/sitarba b/sitarba index c236ba0..3ff4bff 100755 --- a/sitarba +++ b/sitarba @@ -224,6 +224,10 @@ class Config: e = Epoch() if name in self.epochs: raise Config.ReadError("Epoch '{0}' already defined.".format(name)) + p = re.compile(r'^\w+$') + if not p.match(name): + raise Config.ReadError("Epoch name '{0}' does not only " + \ + "comprise alphanumeric characters.".format(name)) if name in Epoch.units: e.unit = name @@ -267,6 +271,11 @@ class Config: def _read_set(self, config, sec): name = sec[4:].strip() + p = re.compile(r'^\w+$') + if not p.match(name): + raise Config.ReadError("Set name '{0}' does not only " + \ + "comprise alphanumeric characters.".format(name)) + dirs = [] excludes = [] diff --git a/sitarba.conf b/sitarba.conf index bd316a8..684afcd 100644 --- a/sitarba.conf +++ b/sitarba.conf @@ -50,7 +50,8 @@ exclude1 = ./home/*/.thunderbird/* # mode = full -# Configure a user-defined epoch called 'biweek'. +# Configure a user-defined epoch called 'biweek'. The epoch's name must +# comprise alphanumeric characters only. [epoch biweek] numkeeps = 13 mode = full @@ -61,7 +62,8 @@ timespan = 2*week -# A file set called 'home'. Each file set is packed into one archive using tar. +# A file set called 'home'. The set's name must comprise alphanumeric +# characters only. Each file set is packed into one archive using tar. [set home] # Each option starting with "dir" contains a single directory which belongs to # this file set. -- 2.39.5