#2021 PR merged: Be safe against empty docker_root_dir (issue 1989)

Labels: bug, cleanup, fixed / solved / done

jsmeix opened issue at 2019-01-21 13:19:

  • Type: Bug Fix

  • Impact: High
    High impact only when docker is used.

  • Reference to related issue (URL):
    https://github.com/rear/rear/issues/1989#issuecomment-456054278

  • How was this pull request tested?
    I do not use docker and I get exactly the same
    var/lib/rear/layout/disklayout.conf as before
    so I assume there are no regressions.

  • Brief description of the changes in this pull request:
    In usr/share/rear/layout/save/GNU/Linux/230_filesystem_layout.sh
    ensure docker_root_dir is not empty because otherwise any
    mountpoint string matches "^" which would skip all mountpoints

jsmeix commented at 2019-01-21 13:54:

@gdha
I did even more:
Now it kills 'docker info' with SIGTERM after 5 seconds
plus with SIGKILL after additional 2 seconds.
I can change it as you like.

jsmeix commented at 2019-01-22 13:00:

@gdha
only FYI:

On my old SLES10 system there is no timeout command
(at least not by default) and it is not in the 'coreutils' RPM on SLES10.

Since SLES11 there is by default a timeout command that is
provided by the 'coreutils' RPM which is installed by default.

Accordingly since this pull request the command in the line

docker_root_dir=$( timeout -k 2s 5s docker info | grep 'Docker Root Dir' | awk '{print $4}' )

will fail so that docker_root_dir gets empty but I assume that
nobody uses Docker on SLES10 so that in practice this should
not add another regression on SLES10 because the above line
is only run

if service docker status

and that even works on SLES10:

# service docker status && echo Y || echo N
service: no such service docker
N

[Export of Github issue for rear/rear.]