#2689 PR merged: Error out in sbin/rear when it failed to source or Source mandatory files

Labels: enhancement, fixed / solved / done

jsmeix opened issue at 2021-10-01 09:34:

  • Type: Enhancement

  • Impact: High
    Normally there should be no difference when things are OK
    but for users with e.g. broken config files the impact is high
    because now they see that their config files are broken.

  • Reference to related issue (URL):
    https://github.com/rear/rear/issues/2686

  • How was this pull request tested?
    I did some quick "rear -D mkrescue" tests with artificial syntax errors
    in default.conf, _input-output-functions.sh, and local.conf

  • Brief description of the changes in this pull request:
    Error out or BugError in sbin/rear when
    it failed to source or Source mandatory files

jsmeix commented at 2021-10-01 09:44:

How things look with artificial syntax errors:

With artificial syntax error in default.conf

# usr/sbin/rear -D mkrescue
/root/rear.github.master/usr/share/rear/conf/default.conf: line 3369: syntax error: unexpected end of file
BUG in Relax-and-Recover:
Failed to source /root/rear.github.master/usr/share/rear/conf/default.conf
Please report it at https://github.com/rear/rear/issues

With artificial syntax error in _input-output-functions.sh

# usr/sbin/rear -D mkrescue
/root/rear.github.master/usr/share/rear/lib/_input-output-functions.sh: line 1307: syntax error: unexpected end of file
BUG in Relax-and-Recover:
Failed to source /root/rear.github.master/usr/share/rear/lib/_input-output-functions.sh
Please report it at https://github.com/rear/rear/issues

With artificial syntax error in global-functions.sh

# usr/sbin/rear -D mkrescue
ERROR: 
====================
BUG in usr/sbin/rear line 490:
'Failed to source /root/rear.github.master/usr/share/rear/lib/global-functions.sh'
--------------------
Please report it at https://github.com/rear/rear/issues
and include all related parts from /root/rear.github.master/var/log/rear/rear-linux-h9wr.log
preferably the whole debug information via 'rear -D mkrescue'
====================
Aborting due to an error, check /root/rear.github.master/var/log/rear/rear-linux-h9wr.log for details
Exiting rear mkrescue (PID 28435) and its descendant processes ...
Running exit tasks
Terminated

With artificial syntax error in conf/Linux-i386.conf

# usr/sbin/rear -D mkrescue
Relax-and-Recover 2.6 / Git
Running rear mkrescue (PID 2662 date 2021-10-01 11:16:33)
Command line options: usr/sbin/rear -D mkrescue
Using log file: /root/rear.github.master/var/log/rear/rear-linux-h9wr.log
Using build area: /var/tmp/rear.X6i2sXlliEiR9DW
ERROR: 
====================
BUG in usr/sbin/rear line 534:
'Failed to Source /root/rear.github.master/usr/share/rear/conf/Linux-i386.conf'
--------------------
Please report it at https://github.com/rear/rear/issues
and include all related parts from /root/rear.github.master/var/log/rear/rear-linux-h9wr.log
preferably the whole debug information via 'rear -D mkrescue'
====================
Aborting due to an error, check /root/rear.github.master/var/log/rear/rear-linux-h9wr.log for details
Exiting rear mkrescue (PID 2662) and its descendant processes ...
Running exit tasks
To remove the build area use (with caution): rm -Rf --one-file-system /var/tmp/rear.X6i2sXlliEiR9DW
Terminated

With artificial syntax error in local.conf

# usr/sbin/rear -D mkrescue
Relax-and-Recover 2.6 / Git
Running rear mkrescue (PID 3124 date 2021-10-01 11:21:13)
Command line options: usr/sbin/rear -D mkrescue
Using log file: /root/rear.github.master/var/log/rear/rear-linux-h9wr.log
Using build area: /var/tmp/rear.pskADyYa22lAW2X
ERROR: Failed to Source /root/rear.github.master/etc/rear/local.conf
Aborting due to an error, check /root/rear.github.master/var/log/rear/rear-linux-h9wr.log for details
Exiting rear mkrescue (PID 3124) and its descendant processes ...
Running exit tasks
To remove the build area use (with caution): rm -Rf --one-file-system /var/tmp/rear.pskADyYa22lAW2X
Terminated

jsmeix commented at 2021-10-01 12:38:

I tested "rear -D recover" with the changes here
and because it "just works" for me
I will "just merge" it right now.


[Export of Github issue for rear/rear.]