Skip to contentSkip to conversation

initscripts: don't background volatile creation

PATCH New Chris Larson 1 participant 1 message Jun 24, 2011

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 initscripts: don't background volatile creation

From: Chris Larson <[email protected]>

This fix is courtesy Chris Hallinan. There is/can be assumptions made in the volatiles file that they're processed in order (e.g. directory created, then files within that directory), yet the script processes them in parallel, backgrounding the operations. This is racy, and means it's possible to end up with dependent files/dirs not created before the bits that need them.

It's likely that this will have a performance impact, but I haven't benchmarked it. Better that we behave correctly than quickly. We can look back into improving the speed of this, without breaking dependencies, in the future.

---
 .../initscripts-1.0/populate-volatile.sh           |   12 ++++++------
 recipes/initscripts/initscripts_1.0.bb             |    2 +-
 2 files changed, 7 insertions(+), 7 deletions(-)
recipes/initscripts/initscripts-1.0/populate-volatile.sh +6 -6
index f0a45ea..d9ec1b7 100755
@@ -19,7 +19,7 @@ create_file() {
 	[ -e "$1" ] && {
 	  [ "${VERBOSE}" != "no" ] && echo "Target already exists. Skipping."
 	} || {
-	  eval $EXEC &
+	  eval $EXEC
 	}
 }
 
@@ -34,7 +34,7 @@ mk_dir() {
 	[ -e "$1" ] && {
 	  [ "${VERBOSE}" != "no" ] && echo "Target already exists. Skipping."
 	} || {
-	  eval $EXEC &
+	  eval $EXEC
 	}
 }
 
@@ -46,7 +46,7 @@ link_file() {
 	[ -e "$2" ] && {
 	  echo "Cannot create link over existing -${TNAME}-." >&2
 	} || {
-	  eval $EXEC &
+	  eval $EXEC
 	}
 }
 
@@ -123,7 +123,7 @@ apply_cfgfile() {
       TSOURCE="$TLTARGET"
       [ -L "${TNAME}" ] || {
         [ "${VERBOSE}" != "no" ] && echo "Creating link -${TNAME}- pointing to -${TSOURCE}-."
-        link_file "${TSOURCE}" "${TNAME}" &
+        link_file "${TSOURCE}" "${TNAME}"
         }
       continue
       }
@@ -142,10 +142,10 @@ apply_cfgfile() {
 
     case "${TTYPE}" in
       "f")  [ "${VERBOSE}" != "no" ] && echo "Creating file -${TNAME}-."
-            create_file "${TNAME}" &
+            create_file "${TNAME}"
 	    ;;
       "d")  [ "${VERBOSE}" != "no" ] && echo "Creating directory -${TNAME}-."
-            mk_dir "${TNAME}" &
+            mk_dir "${TNAME}"
 	    # Add check to see if there's an entry in fstab to mount.
 	    ;;
       *)    [ "${VERBOSE}" != "no" ] && echo "Invalid type -${TTYPE}-."
recipes/initscripts/initscripts_1.0.bb +1 -1
index 87a0e99..adf8594 100644
@@ -4,7 +4,7 @@ PRIORITY = "required"
 DEPENDS = "makedevs"
 RDEPENDS_${PN} = "makedevs"
 LICENSE = "GPL"
-PR = "r128"
+PR = "r129"
 
 SRC_URI = "file://functions \
            file://halt \
Signature · 1 line
1.7.5.4