#2322 PR closed: Verify that ReaR scripts are actually run under bash

Labels: enhancement, discuss / RFC, no-pr-activity

jsmeix opened issue at 2020-01-23 10:19:

At the very beginning of user/sbin/rear
verify that the specified interpreter /bin/bash actually is bash
because the initial line #!/bin/bash alone might not be sufficient
cf. https://github.com/rear/rear/issues/2307#issuecomment-577591217

jsmeix commented at 2020-01-23 10:33:

My current check does not yet work good enough
because when I specify #!/bin/sh in usr/sbin/rear
the check succeeds because I have a symlink /bin/sh -> bash
(so /bin/sh --version reports GNU bash ...)
but rear fails in plain sh mode with things like

# usr/sbin/rear dump
/root/rear.github.master/usr/share/rear/lib/_input-output-functions.sh: line 369: `trap': is a special builtin
/root/rear.github.master/usr/share/rear/lib/_input-output-functions.sh: line 296: LogPrint: command not found

so I need to further enhance the check...

jsmeix commented at 2020-01-23 11:39:

do you think such additional checks are useful in practice
to let ReaR error out early when things "look fishy"
according to "Try hard to care about possible errors" in
could it happen that ReaR falsely errors out at those checks
while in fact things are OK?

jsmeix commented at 2020-01-27 14:43:

According to
some kind of verification that bash is used to run the ReaR scripts
is needed to avoid inexplicable errors as in
that need much too long to see what the actual root cause is.

github-actions commented at 2020-07-19 01:34:

Stale pull request message

[Export of Github issue for rear/rear.]