| Submitter | James Limbouris |
|---|---|
| Date | June 7, 2011, 2:58 a.m. |
| Message ID | <840A81C1B782724A8EB52725BD519EFF02E499@MBX20.4emm.local> |
| Download | mbox | patch |
| Permalink | /patch/5487/ |
| State | Superseded |
| Headers | show |
Comments
Dear James, thank you for your patch. I am also putting you into CC not knowing if you read the list regularly. (I am reading the list.) Am Dienstag, den 07.06.2011, 02:58 +0000 schrieb James Limbouris: please resend your patch [2], as the commit message ended up in the subject line/commit summary. Please also prefix the commit summary with the recipe name [1] and format your name correctly in the Signed-off-by line. You can take the following one as a starting point and please adapt/improve it. 8<-------------------------------------------------------------------->8 initscripts: Modify `populate-volatile.sh` to atomically update `volatile.cache` When power is lost during boot it could happen that `/etc/volatile.cache` is written too and lays around during the next boot causing the following problems. Using a temporary file and renaming it at once avoids those issues. Signed-off-by: James Limbouris <james@digitalmatter.com.au> 8<-------------------------------------------------------------------->8 > --- > .../initscripts-1.0/populate-volatile.sh | 10 ++++++---- > 1 files changed, 6 insertions(+), 4 deletions(-) > > diff --git a/recipes/initscripts/initscripts-1.0/populate-volatile.sh b/recipes/initscripts/initscripts-1.0/populate-volatile.sh > index 3bb3d94..e355680 100755 > --- a/recipes/initscripts/initscripts-1.0/populate-volatile.sh > +++ b/recipes/initscripts/initscripts-1.0/populate-volatile.sh > @@ -14,7 +14,7 @@ create_file() { > 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 " > > - test "$VOLATILE_ENABLE_CACHE" = yes && echo "$EXEC" >> /etc/volatile.cache > + test "$VOLATILE_ENABLE_CACHE" = yes && echo "$EXEC" >> /etc/volatile.cache.build > > [ -e "$1" ] && { > [ "${VERBOSE}" != "no" ] && echo "Target already exists. Skipping." > @@ -29,7 +29,7 @@ mk_dir() { > 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 " > > - test "$VOLATILE_ENABLE_CACHE" = yes && echo "$EXEC" >> /etc/volatile.cache > + test "$VOLATILE_ENABLE_CACHE" = yes && echo "$EXEC" >> /etc/volatile.cache.build > > [ -e "$1" ] && { > [ "${VERBOSE}" != "no" ] && echo "Target already exists. Skipping." > @@ -41,7 +41,7 @@ mk_dir() { > link_file() { > EXEC="test -e \"$2\" -o -L $2 || ln -s \"$1\" \"$2\" >/dev/tty0 2>&1" > > - test "$VOLATILE_ENABLE_CACHE" = yes && echo " $EXEC" >> /etc/volatile.cache > + test "$VOLATILE_ENABLE_CACHE" = yes && echo " $EXEC" >> /etc/volatile.cache.build > > [ -e "$2" ] && { > echo "Cannot create link over existing -${TNAME}-." >&2 > @@ -164,8 +164,10 @@ if test -e /etc/volatile.cache -a "$VOLATILE_ENABLE_CACHE" = "yes" -a "x$1" != " > then > sh /etc/volatile.cache > else > - rm -f /etc/volatile.cache > + rm -f /etc/volatile.cache /etc/volatile.cache.build > for file in `ls -1 "${CFGDIR}" | sort`; do > apply_cfgfile "${CFGDIR}/${file}" > done > + > + [ -e /etc/volatile.cache.build ] && sync && mv /etc/volatile.cache.build /etc/volatile.cache > fi Does not `/etc/volatile.cache.build` need to be removed during the next boot up? Thanks, Paul [1] http://openembedded.org/index.php/Commit_Policy [2] http://openembedded.org/index.php/How_to_submit_a_patch_to_OpenEmbedded
> -----Original Message----- > From: Paul Menzel [mailto:paulepanter@users.sourceforge.net] > Sent: Tuesday, 7 June 2011 4:50 PM > To: openembedded-devel@lists.openembedded.org > Cc: James Limbouris > Subject: Re: [oe] [PATCH] Modified populate-volatile.sh to atomically update > volatile.cache, to avoid power loss issues. Signed-off-by: jameslimbouris > <james@digitalmatter.com.au> > > Dear James, > > > thank you for your patch. > ... > > please resend your patch [2], as the commit message ended up in the > subject line/commit summary. Please also prefix the commit summary with > the recipe name [1] and format your name correctly in the Signed-off-by > line. You can take the following one as a starting point and please > adapt/improve it. > ... > > Does not `/etc/volatile.cache.build` need to be removed during the next > boot up? > > Thanks, > > Paul Thanks Paul, I thought it looked a bit odd... I'm still getting used to all of these Git scripts. I've just mailed a second attempt through. I don't think we need to explicitly remove `/etc/volatile.cache.build`, as the script should rebuild the volatiles cache on the next boot, which will remove, rebuild, and rename the .build file. Regards, James Limbouris
Patch
diff --git a/recipes/initscripts/initscripts-1.0/populate-volatile.sh b/recipes/initscripts/initscripts-1.0/populate-volatile.sh index 3bb3d94..e355680 100755 --- a/recipes/initscripts/initscripts-1.0/populate-volatile.sh +++ b/recipes/initscripts/initscripts-1.0/populate-volatile.sh @@ -14,7 +14,7 @@ create_file() { 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 " - test "$VOLATILE_ENABLE_CACHE" = yes && echo "$EXEC" >> /etc/volatile.cache + test "$VOLATILE_ENABLE_CACHE" = yes && echo "$EXEC" >> /etc/volatile.cache.build [ -e "$1" ] && { [ "${VERBOSE}" != "no" ] && echo "Target already exists. Skipping." @@ -29,7 +29,7 @@ mk_dir() { 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 " - test "$VOLATILE_ENABLE_CACHE" = yes && echo "$EXEC" >> /etc/volatile.cache + test "$VOLATILE_ENABLE_CACHE" = yes && echo "$EXEC" >> /etc/volatile.cache.build [ -e "$1" ] && { [ "${VERBOSE}" != "no" ] && echo "Target already exists. Skipping." @@ -41,7 +41,7 @@ mk_dir() { link_file() { EXEC="test -e \"$2\" -o -L $2 || ln -s \"$1\" \"$2\" >/dev/tty0 2>&1" - test "$VOLATILE_ENABLE_CACHE" = yes && echo " $EXEC" >> /etc/volatile.cache + test "$VOLATILE_ENABLE_CACHE" = yes && echo " $EXEC" >> /etc/volatile.cache.build [ -e "$2" ] && { echo "Cannot create link over existing -${TNAME}-." >&2 @@ -164,8 +164,10 @@ if test -e /etc/volatile.cache -a "$VOLATILE_ENABLE_CACHE" = "yes" -a "x$1" != " then sh /etc/volatile.cache else - rm -f /etc/volatile.cache + rm -f /etc/volatile.cache /etc/volatile.cache.build for file in `ls -1 "${CFGDIR}" | sort`; do apply_cfgfile "${CFGDIR}/${file}" done + + [ -e /etc/volatile.cache.build ] && sync && mv /etc/volatile.cache.build /etc/volatile.cache fi