#1440 PR closed: Ensure that ROOTFS_DIR variable is set with non-null value.

Labels: won't fix / can't fix / obsolete

jstourac opened issue at 2017-08-08 14:29:

  • In case ROOTFS_DIR would, by an accident, was set empty or not to set at all, then system
    level configuration files would be overwritten then.

Actually there are quite a lot more occurrences like this. I guess I could look at it. Let me know if you are ok to change all of those or not.

schlomo commented at 2017-08-08 14:39:

@jstourac In general this is a great idea to make ReaR more robust. Can you please let us know why you started from this particular script? Is there some context for this choice?

In #700 we discussed making ReaR work under set -eu and came to the conclusion that this is nearly impossible at the moment.

Instead of fixing this one script I can imagine to add a more generic script somewhere else that will ensure that certain variables are set, like an assertion:

: ${ROOTFS_DIR:?must be set}

That way all scripts would be protected, not just this one.

jstourac commented at 2017-08-14 07:43:

Hi @schlomo,

reason I started with this one script is because I suspected that my configuration of sshd on my RHEL6 testing machine was modified by execution of {{/usr/sbin/rear checklayout || /usr/sbin/rear mkrescue}}, used ReaR was in version of 1.17.2. Although, I was not able to reproduce and neither I could not find out how that would be possible after I briefly looked in the source code.

Anyway, I think that such check is useful to prevent potential modifications of system files, that is why I proposed this MR to start a discussion.

schlomo commented at 2017-08-14 08:09:

I see. What do you think about adding assertions somewhere higher up or earlier in the script execution flow?

jsmeix commented at 2017-08-21 12:49:

I think ensure that certain variables are set is something for
https://github.com/rear/rear/issues/1251

gdha commented at 2018-03-12 13:44:

As nobody is complaining about this in the past I'm pro closing this PR without further implementation.


[Export of Github issue for rear/rear.]