backups: an empty value in a .reg export must not fail the file
A line of the form "Name=" with nothing after the sign is not strictly legal, but it occurs in real exports - the part marker's WJPRT.reg has KRelay1 like this. The parser raised on it, which failed the whole file, which meant that machine could never be backed up at all. Read it as an empty string so the value name is still preserved.
This commit is contained in:
@@ -149,6 +149,13 @@ def _parsevalue(body):
|
||||
return _parsehexvalue(body)
|
||||
if body == '-':
|
||||
return 'DELETE', None
|
||||
if body == '':
|
||||
# "Name=" with nothing after the sign. Not strictly legal, but it
|
||||
# occurs in real exports (the part marker's WJPRT.reg has KRelay1 like
|
||||
# this), and failing the whole file over it would mean that machine can
|
||||
# never be backed up. Treat it as an empty string so the value NAME is
|
||||
# still preserved.
|
||||
return 'REG_SZ', ''
|
||||
raise NtlarsParseError('unrecognised value form: {!r}'.format(body))
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user