[OE-core] [PATCH] initscripts: remove warnings on read-only-rootfs (again)

Jacob Kroon jacob.kroon at gmail.com
Mon Sep 17 08:18:01 UTC 2018


On Fri, Jul 13, 2018 at 2:44 PM Martin Hundebøll <martin at geanix.com> wrote:
>
> When the populate-volatile.sh initscript tests if a configured symlink
> is already in place, it uses readlink with the '-f' (follow) option:
>
> > [ "$(readlink -f $source)" = "$dest" ]
>
> If the test fails, it proceeds to delete the exisiting folder/file, and
> create the configured symlink.
>
> However, the '-f' option to readlink makes it follow symlinks pointing
> at symlinks. If the $dest argument is a symlink, the above test fails,
> and warnings are printed due to changing a read-only rootfs.
>
> This is the case for /tmp, and /etc/resolv.conf:
> > /tmp -> /var/tmp -> /var/volatile/tmp
> > /etc/resolv.conf -> /var/run/resolv.conf -> /run/resolv.conf
>
> Fix the warnings by removing the '-f' option, so that the test matches
> the configuration.
>
> Signed-off-by: Martin Hundebøll <martin at geanix.com>
> ---
>  .../initscripts/initscripts-1.0/populate-volatile.sh            | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/meta/recipes-core/initscripts/initscripts-1.0/populate-volatile.sh b/meta/recipes-core/initscripts/initscripts-1.0/populate-volatile.sh
> index 35316ec2ba..e1fce02906 100755
> --- a/meta/recipes-core/initscripts/initscripts-1.0/populate-volatile.sh
> +++ b/meta/recipes-core/initscripts/initscripts-1.0/populate-volatile.sh
> @@ -80,7 +80,7 @@ mk_dir() {
>  link_file() {
>         EXEC="
>         if [ -L \"$2\" ]; then
> -               [ \"\$(readlink -f \"$2\")\" != \"$1\" ] && { rm -f \"$2\"; ln -sf \"$1\" \"$2\"; };
> +               [ \"\$(readlink \"$2\")\" != \"$1\" ] && { rm -f \"$2\"; ln -sf \"$1\" \"$2\"; };
>         elif [ -d \"$2\" ]; then
>                 if awk '\$2 == \"$2\" {exit 1}' /proc/mounts; then
>                         cp -a $2/* $1 2>/dev/null;
> --
> 2.18.0
>
> --
> _______________________________________________
> Openembedded-core mailing list
> Openembedded-core at lists.openembedded.org
> http://lists.openembedded.org/mailman/listinfo/openembedded-core

ping ?
This patch prevents some warnings related to /tmp and /etc/resolv.conf
from being printed, when using read-only-rootfs. Would be nice to have
the same fix backported to sumo too.

/Jacob



More information about the Openembedded-core mailing list