Skip to contentSkip to conversation

initscripts: remove warnings on read-only-rootfs (again)

PATCH In review Jacob Kroon 1 participant 2 messages Aug 21, 2019 – Aug 22, 2019

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 initscripts: remove warnings on read-only-rootfs (again)

From: Martin Hundebøll <[email protected]>

When the populate-volatile.sh initscript tests if a configured symlink is already in place, it uses readlink with the '-f' (follow) option:

Quoted 1 line

[ "$(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:

Quoted 2 lines

/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.

[ YOCTO #10814 ]

---

v2:
* Added my own signed-off-by tag
* Added reference to YOCTO #10814
* Original patch: https://patchwork.openembedded.org/patch/152602/

 .../initscripts/initscripts-1.0/populate-volatile.sh            | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
meta/recipes-core/initscripts/initscripts-1.0/populate-volatile.sh +1 -1
index 6f965a6870..1c525b71bd 100755
@@ -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;
Signature · 1 line
2.21.0
#1 lore raw
Quoted 41 lines · Jacob Kroon

From: Martin Hundebøll <[email protected]>

When the populate-volatile.sh initscript tests if a configured symlink is already in place, it uses readlink with the '-f' (follow) option:

Quoted 1 line

[ "$(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:

Quoted 2 lines

/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.

[ YOCTO #10814 ]

---

v2:
* Added my own signed-off-by tag
* Added reference to YOCTO #10814
* Original patch: https://patchwork.openembedded.org/patch/152602/

  .../initscripts/initscripts-1.0/populate-volatile.sh            | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
meta/recipes-core/initscripts/initscripts-1.0/populate-volatile.sh +0 -0
index 6f965a6870..1c525b71bd 100755

meta/recipes-core/initscripts/initscripts-1.0/populate-volatile.sh mk_dir() { · line 86

Quoted 8 lines
meta/recipes-core/initscripts/initscripts-1.0/populate-volatile.sh +1 -1
@@ -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;

Hi Chen,

Can I ask you to review the patch above ?
Having spent some time staring at the change and reading up on intended behaviour, I think the patch is correct.

Thanks,
Jacob