On Thu, Mar 06, 2025 at 08:17:41AM +0000, Nirjhar Roy (IBM) wrote: > Silently executing scripts during sourcing common/rc doesn't look good > and also causes unnecessary script execution. Decouple init_rc() call > and call init_rc() explicitly where required. > > Signed-off-by: Nirjhar Roy (IBM) <nirjhar.roy.lists@xxxxxxxxx> > --- > check | 10 ++-------- > common/preamble | 1 + > common/rc | 2 -- > soak | 1 + > 4 files changed, 4 insertions(+), 10 deletions(-) > > diff --git a/check b/check > index ea92b0d6..d30af1ba 100755 > --- a/check > +++ b/check > @@ -840,16 +840,8 @@ function run_section() > _prepare_test_list > elif [ "$OLD_TEST_FS_MOUNT_OPTS" != "$TEST_FS_MOUNT_OPTS" ]; then > _test_unmount 2> /dev/null > - if ! _test_mount > - then > - echo "check: failed to mount $TEST_DEV on $TEST_DIR" > - status=1 > - exit > - fi Unrelated change? I was expecting a mechanical ". ./common/rc" => ". ./common/rc ; init_rc" change in this patch. > fi > > - init_rc Why remove init_rc here? > - > seq="check.$$" > check="$RESULT_BASE/check" > > @@ -870,6 +862,8 @@ function run_section() > needwrap=true > > if [ ! -z "$SCRATCH_DEV" ]; then > + _check_mounted_on SCRATCH_DEV $SCRATCH_DEV SCRATCH_MNT $SCRATCH_MNT > + [ $? -le 1 ] || exit 1 > _scratch_unmount 2> /dev/null > # call the overridden mkfs - make sure the FS is built > # the same as we'll create it later. > diff --git a/common/preamble b/common/preamble > index 0c9ee2e0..c92e55bb 100644 > --- a/common/preamble > +++ b/common/preamble > @@ -50,6 +50,7 @@ _begin_fstest() > _register_cleanup _cleanup > > . ./common/rc > + init_rc > > # remove previous $seqres.full before test > rm -f $seqres.full $seqres.hints > diff --git a/common/rc b/common/rc > index d2de8588..f153ad81 100644 > --- a/common/rc > +++ b/common/rc > @@ -5754,8 +5754,6 @@ _require_program() { > _have_program "$1" || _notrun "$tag required" > } > > -init_rc > - > ################################################################################ > # make sure this script returns success > /bin/true > diff --git a/soak b/soak > index d5c4229a..5734d854 100755 > --- a/soak > +++ b/soak > @@ -5,6 +5,7 @@ > > # get standard environment, filters and checks > . ./common/rc > +# ToDo: Do we need an init_rc() here? How is soak used? I have no idea what soak does and have never used it, but I think for continuity's sake you should call init_rc here. --D > . ./common/filter > > tmp=/tmp/$$ > -- > 2.34.1 > >