#1845 Issue closed: apply_layout_mappings function is not sufficiently fail safe

Labels: enhancement, cleanup, fixed / solved / done, minor bug

jsmeix opened issue at 2018-06-28 10:28:

The current apply_layout_mappings function is not sufficiently fail safe.

In particular things go wrong when for a target disk in /var/lib/rear/layout/disk_mappings
no associated mapping for that disk as source disk exists.
For example when I have /dev/sda and /dev/sdb both with same size
I get /var/lib/rear/layout/disk_mappings generated as

/dev/sda /dev/sda
/dev/sdb /dev/sdb

When I change that to

/dev/sda /dev/sdb
#/dev/sdb /dev/sdb

I get disklayout.conf changed into (excerpts):

disk /dev/sdb 21474836480 msdos
disk _REAR1_ 21474836480 msdos

Furthermore the current apply_layout_mappings function runs mad if
there are lines with unexpected syntax in /var/lib/rear/layout/disk_mappings
in particular if there are empty lines.

Because in MIGRATION_MODE /var/lib/rear/layout/disk_mappings is meant
to be manually adapted by the user ReaR should behave more fail safe against
possibly missing or wrong entries in /var/lib/rear/layout/disk_mappings.
Currently ReaR blindly proceeds in such cases.

jsmeix commented at 2018-06-28 12:02:

In
https://github.com/rear/rear/pull/1843
the commit
https://github.com/rear/rear/pull/1843/commits/ba2aefa9e3f3dc5c28f35720644bb4e694cd0a63
should make the apply_layout_mappings function and its callers behave more fail safe.

jsmeix commented at 2018-06-29 13:08:

With https://github.com/rear/rear/pull/1843 merged
this issue should be fixed.


[Export of Github issue for rear/rear.]