All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/3] initscripts: populate-volatile.sh: do not log to tty0
@ 2021-07-21 14:10 Matthias Schiffer
  2021-07-21 14:10 ` [PATCH 2/3] initscripts: populate-volatile.sh: run create_file synchronously Matthias Schiffer
  2021-07-21 14:10 ` [PATCH 3/3] initscripts: fix creation order for /var/log with VOLATILE_LOG_DIR=true Matthias Schiffer
  0 siblings, 2 replies; 3+ messages in thread
From: Matthias Schiffer @ 2021-07-21 14:10 UTC (permalink / raw)
  To: openembedded-core; +Cc: Matthias Schiffer

tty0 may not be the intended console for log messages, or it may not
exist at all in kernel configurations without CONFIG_VT. Just use the
default stdout/stderr instead.

Signed-off-by: Matthias Schiffer <matthias.schiffer@ew.tq-group.com>
---
 .../initscripts/initscripts-1.0/populate-volatile.sh      | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

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 f21f48dd30..f8b42c6893 100755
--- a/meta/recipes-core/initscripts/initscripts-1.0/populate-volatile.sh
+++ b/meta/recipes-core/initscripts/initscripts-1.0/populate-volatile.sh
@@ -37,8 +37,8 @@ create_file() {
 	fi
 	EXEC="
 	${EXEC}
-	chown ${TUSER}:${TGROUP} $1 || echo \"Failed to set owner -${TUSER}- for -$1-.\" >/dev/tty0 2>&1;
-	chmod ${TMODE} $1 || echo \"Failed to set mode -${TMODE}- for -$1-.\" >/dev/tty0 2>&1 "
+	chown ${TUSER}:${TGROUP} $1 || echo \"Failed to set owner -${TUSER}- for -$1-.\";
+	chmod ${TMODE} $1 || echo \"Failed to set mode -${TMODE}- for -$1-.\" "
 
 	test "$VOLATILE_ENABLE_CACHE" = yes && echo "$EXEC" >> /etc/volatile.cache.build
 
@@ -60,8 +60,8 @@ create_file() {
 mk_dir() {
 	EXEC="
 	mkdir -p \"$1\";
-	chown ${TUSER}:${TGROUP} $1 || echo \"Failed to set owner -${TUSER}- for -$1-.\" >/dev/tty0 2>&1;
-	chmod ${TMODE} $1 || echo \"Failed to set mode -${TMODE}- for -$1-.\" >/dev/tty0 2>&1 "
+	chown ${TUSER}:${TGROUP} $1 || echo \"Failed to set owner -${TUSER}- for -$1-.\";
+	chmod ${TMODE} $1 || echo \"Failed to set mode -${TMODE}- for -$1-.\" "
 
 	test "$VOLATILE_ENABLE_CACHE" = yes && echo "$EXEC" >> /etc/volatile.cache.build
 	if [ -e "$1" ]; then
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH 2/3] initscripts: populate-volatile.sh: run create_file synchronously
  2021-07-21 14:10 [PATCH 1/3] initscripts: populate-volatile.sh: do not log to tty0 Matthias Schiffer
@ 2021-07-21 14:10 ` Matthias Schiffer
  2021-07-21 14:10 ` [PATCH 3/3] initscripts: fix creation order for /var/log with VOLATILE_LOG_DIR=true Matthias Schiffer
  1 sibling, 0 replies; 3+ messages in thread
From: Matthias Schiffer @ 2021-07-21 14:10 UTC (permalink / raw)
  To: openembedded-core; +Cc: Matthias Schiffer

The behavior of running create_file in the background was introduced in
d44816bedade ("initscripts: Populate volatile from existing file")
without further explanation. Besides its questionable benefit, this
causes actual issues:

- Not all create_file processes may have finished by the time the
  initscript exits (or when it moves /etc/volatile.cache.build !)
- By making the order of commands nondeterminstic, it could hide
  dependency issues where it was attempted to create files before their
  containing directories

Signed-off-by: Matthias Schiffer <matthias.schiffer@ew.tq-group.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 f8b42c6893..b56b72f833 100755
--- a/meta/recipes-core/initscripts/initscripts-1.0/populate-volatile.sh
+++ b/meta/recipes-core/initscripts/initscripts-1.0/populate-volatile.sh
@@ -201,7 +201,7 @@ apply_cfgfile() {
 			"f")  [ "${VERBOSE}" != "no" ] && echo "Creating file -${TNAME}-."
 				TSOURCE="$TLTARGET"
 				[ "${TSOURCE}" = "none" ] && TSOURCE=""
-				create_file "${TNAME}" "${TSOURCE}" &
+				create_file "${TNAME}" "${TSOURCE}"
 				;;
 			"d")  [ "${VERBOSE}" != "no" ] && echo "Creating directory -${TNAME}-."
 				mk_dir "${TNAME}"
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH 3/3] initscripts: fix creation order for /var/log with VOLATILE_LOG_DIR=true
  2021-07-21 14:10 [PATCH 1/3] initscripts: populate-volatile.sh: do not log to tty0 Matthias Schiffer
  2021-07-21 14:10 ` [PATCH 2/3] initscripts: populate-volatile.sh: run create_file synchronously Matthias Schiffer
@ 2021-07-21 14:10 ` Matthias Schiffer
  1 sibling, 0 replies; 3+ messages in thread
From: Matthias Schiffer @ 2021-07-21 14:10 UTC (permalink / raw)
  To: openembedded-core; +Cc: Matthias Schiffer

Create the /var/log symlink directly after /var/volatile/log, so
/var/log is available for the creation of /var/log/wtmp a few lines
later.

Signed-off-by: Matthias Schiffer <matthias.schiffer@ew.tq-group.com>
---

An alternative solution would be to move the creation of the /var/log
link (and possibly /var/volatile/log itself) to a separate volatile list
that is applied before 00_core. This would simplify the code and improve
compatiblity with patch [1] (currently applied downstream by
WindRiver Linux, I'm not sure what the status is regarding inclusion in
OpenEmbedded core).


[1] https://patchwork.openembedded.org/patch/176834/


 meta/recipes-core/initscripts/initscripts_1.0.bb | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/meta/recipes-core/initscripts/initscripts_1.0.bb b/meta/recipes-core/initscripts/initscripts_1.0.bb
index 5e994f2b7f..65f9c0ae8d 100644
--- a/meta/recipes-core/initscripts/initscripts_1.0.bb
+++ b/meta/recipes-core/initscripts/initscripts_1.0.bb
@@ -106,7 +106,8 @@ do_install () {
 	install -m 0755    ${WORKDIR}/save-rtc.sh	${D}${sysconfdir}/init.d
 	install -m 0644    ${WORKDIR}/volatiles		${D}${sysconfdir}/default/volatiles/00_core
 	if [ ${@ oe.types.boolean('${VOLATILE_LOG_DIR}') } = True ]; then
-		echo "l root root 0755 /var/log /var/volatile/log" >> ${D}${sysconfdir}/default/volatiles/00_core
+		sed -i -e '\@^d root root 0755 /var/volatile/log none$@ a\l root root 0755 /var/log /var/volatile/log' \
+			${D}${sysconfdir}/default/volatiles/00_core
 	fi
 	install -m 0755    ${WORKDIR}/dmesg.sh		${D}${sysconfdir}/init.d
 	install -m 0644    ${WORKDIR}/logrotate-dmesg.conf ${D}${sysconfdir}/
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-07-21 14:12 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-21 14:10 [PATCH 1/3] initscripts: populate-volatile.sh: do not log to tty0 Matthias Schiffer
2021-07-21 14:10 ` [PATCH 2/3] initscripts: populate-volatile.sh: run create_file synchronously Matthias Schiffer
2021-07-21 14:10 ` [PATCH 3/3] initscripts: fix creation order for /var/log with VOLATILE_LOG_DIR=true Matthias Schiffer

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.