set and epoch's name must comprise alphanum chars
authorStefan Huber <shuber2@gmx.at>
Wed, 23 May 2012 06:42:21 +0000 (08:42 +0200)
committerStefan Huber <shuber2@gmx.at>
Wed, 23 May 2012 06:42:21 +0000 (08:42 +0200)
sitarba
sitarba.conf

diff --git a/sitarba b/sitarba
index c236ba0589e68018b41991ba3231ef40b6396ed3..3ff4bfff4754abd7fd37c110f803315cfefb3a8f 100755 (executable)
--- 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 = []
 
index bd316a85ac55c6619bbfab85596d1ac3fa03ab13..684afcd82ecc3dd1c13cdfc53aefd330227fd67f 100644 (file)
@@ -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.