Using regular expressions in NSsbackup does not work properly.
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
nssbackup |
Fix Released
|
High
|
Jean-Peer Lorenz |
Bug Description
Using regular expressions in NSsbackup does not work properly:
This bug report collects some issues concerning the use of regular expressions for definition of exclusions within NSsbackup. These issues are:
1. it is possible to add an empty expression using the graphical configuration tool
2. if an invalid regular expression was created with a prior version of NSsbackup (or by editing the configuration file manually), the demon 'nssbackupd' fails with following exception:
2008-11-07 19:16:53,802 - DEBUG - BackupManager.
2008-11-07 19:16:53,803 - ERROR - nssbackupd.
2008-11-07 19:16:53,822 - ERROR - nssbackupd.
File "/usr/local/
File "/usr/local/
File "/usr/local/
rexclude = [ re.compile(p) for p in self.__
File "/usr/lib/
return _compile(pattern, flags)
File "/usr/lib/
raise error, v # invalid expression
error: unexpected end of regular expression
This should be avoided. This bug is critical since the backup fails.
3. It is _not_ possible to remove ALL defined regular expressions in configuration GUI, i.e. defined regexps and defined filetypes. The very last expression is removed from the displayed list but not from the conf-file.
4. if an invalid regular expression was created with a prior version of NSsbackup (or by editing the configuration file manually) the expression is displayed in GUI and is saved again. This should be avoided.
Changed in nssbackup: | |
assignee: | nobody → peer.loz |
importance: | Undecided → High |
milestone: | none → release0.2 |
status: | New → Confirmed |
Changed in nssbackup: | |
status: | Confirmed → Fix Committed |
Changed in nssbackup: | |
status: | Fix Committed → Fix Released |
Here is a patch to fix the reported issues above.
Explanations on the modifications:
=== modified file 'src/nssbackup/ util/__ init__. py':
* adding new functions to unify checking of expressions (maybe it is useful for further versions to create somekind of ConfigurationHa ndler class to encapsulate reading configuration files, checking of configuration values and setting of new ones - so this is a bugfix only for the current release candidate version)
=== modified file 'src/nssbackup/ ui/SBConfigGTK. py':
* adding a method for showing a dialogbox containing an errormessage
* the regular expressions from the configuration file were checked before they are added to any lists; if they are invalid they were removed and the users gets informed. This fixes issue 4).
* if a regular expression is added to the configuration, the resulting line gets stripped off leading and trailing ',' to avoid to unwanted adding of an empty expression
* in method 'on_ex_ delregex_ clicked' : the removal of an expression is done by the function mentioned above. The last expression didn't had a leading comma, so it was not removed. This fixes issue 3).
* in method 'cell_regex_ edited_ callback' : it was possible to clear the expression and therefore an empty expression was stored. The fix now checks not only for a valid expression but additionally for a not empty expression. This fixes issue 1).
* while checking regular expression only 're.error' were catched now.
=== modified file 'src/nssbackup/ managers/ BackupManager. py':
* while reading the configuration it is checked whether the expression is not empty and valid. If so it is added otherwise output a log message. This fixes issue 2).
=== modified file 'src/nssbackup/ managers/ SnapshotManager .py'
* string formatting was errornous. Fixed without changing the content of translated string. This fixes bug Bug #299964: Exception 'TypeError' is raised if an error occurs while pulling a snapshot.