[dora,2/2] populate-extfs.sh: error out if debugfs encounters some error

Submitted by Qi.Chen@windriver.com on June 19, 2014, 2:11 a.m. | Patch ID: 74047


Message ID 4d0c87a79fdde16dcad0783cac294feb8285e215.1403143738.git.Qi.Chen@windriver.com
State New
Headers show

Commit Message

Qi.Chen@windriver.com June 19, 2014, 2:11 a.m.
Previously, even if we encounter some error when populating the
ext filesystem, we don't error out and the rootfs process still

However, what's really expected is that the populate-extfs.sh script
should error out if something wrong happens when using `debugfs' to
generate the ext filesystem. For example, if there's not enough block
in the filesystem, and allocating a block for some file fails, the
failure should not be ignored. Otherwise, we will have a successful
build but a corrupted filesystem.

The debugfs returns 0 as long as the command is valid. That is, even
if the command fails, the debugfs still returns 0. That's really a
pain here. That's why this patch checks the error output to see whether
there's any error logged.

Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
 .../e2fsprogs/e2fsprogs-1.42.8/populate-extfs.sh   |    7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

Patch hide | download patch | download mbox

diff --git a/meta/recipes-devtools/e2fsprogs/e2fsprogs-1.42.8/populate-extfs.sh b/meta/recipes-devtools/e2fsprogs/e2fsprogs-1.42.8/populate-extfs.sh
index da3954e..23d97d3 100644
--- a/meta/recipes-devtools/e2fsprogs/e2fsprogs-1.42.8/populate-extfs.sh
+++ b/meta/recipes-devtools/e2fsprogs/e2fsprogs-1.42.8/populate-extfs.sh
@@ -94,4 +94,9 @@  DEBUGFS="debugfs"
 		echo "sif $SRC links_count $LN_CNT"
 	rm -fr $INODE_DIR
-} | $DEBUGFS -w -f - $DEVICE
+} | $DEBUGFS -w -f - $DEVICE 2>&1 1>/dev/null | grep '.*: .*'
+if [ $? = 0 ]; then
+    echo "Some error occured while executing [$DEBUGFS -w -f - $DEVICE]"
+    exit 1