Skip to contentSkip to conversation

populate-extfs.sh: two fixes

PATCH New Chen Qi 1 participant 3 messages Jun 19, 2014

lore
Share & tools
lore

Chen Qi

author
#0 lore raw

cover populate-extfs.sh: two fixes

The following changes since commit b7371b49b4b83c2e864126480b65363fe9f2cfd2:

x264: Update SRCREV to match commit in upstream git repo (2014-06-17 17:59:55 +0100)

are available in the git repository at:

git://git.openembedded.org/openembedded-core-contrib ChenQi/dora-populate-extfs
http://cgit.openembedded.org/cgit.cgi/openembedded-core-contrib/log/?h=ChenQi/dora-populate-extfs

Chen Qi (2):
populate-extfs.sh: fix to handle /var/lib/opkg/alternatives/[[
correctly
populate-extfs.sh: error out if debugfs encounters some error

 .../e2fsprogs/e2fsprogs-1.42.8/populate-extfs.sh   |   10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)
Signature · 1 line
1.7.9.5
author
#1 lore raw

PATCH 1/2 populate-extfs.sh: fix to handle /var/lib/opkg/alternatives/[[ correctly

There was a patch trying to fix this problem by using 'dirname', but it caused some build failures, thus got reverted.

The problem is that $DIR might be empty and we should first do the check before trying to use $(dirname $DIR).

[YOCTO #5712]

---
 .../e2fsprogs/e2fsprogs-1.42.8/populate-extfs.sh   |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
meta/recipes-devtools/e2fsprogs/e2fsprogs-1.42.8/populate-extfs.sh +2 -1
index 7de720b..da3954e 100644
@@ -23,12 +23,13 @@ DEBUGFS="debugfs"
 	find $SRCDIR | while read FILE; do
                 TGT="${FILE##*/}"
                 DIR="${FILE#$SRCDIR}"
-                DIR="${DIR%$TGT}"
 
 		# Skip the root dir
 		[ ! -z "$DIR" ] || continue
 		[ ! -z "$TGT" ] || continue
 
+                DIR="$(dirname $DIR)"
+
 		if [ "$DIR" != "$CWD" ]; then
 			echo "cd $DIR"
 			CWD="$DIR"
Signature · 1 line
1.7.9.5
author
#2 lore raw

PATCH 2/2 populate-extfs.sh: error out if debugfs encounters some error

In reply to Chen Qi

Previously, even if we encounter some error when populating the ext filesystem, we don't error out and the rootfs process still succeeds.

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.

---
 .../e2fsprogs/e2fsprogs-1.42.8/populate-extfs.sh   |    7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
meta/recipes-devtools/e2fsprogs/e2fsprogs-1.42.8/populate-extfs.sh +6 -1
index da3954e..23d97d3 100644
@@ -94,4 +94,9 @@ DEBUGFS="debugfs"
 		echo "sif $SRC links_count $LN_CNT"
 	done
 	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
+fi
Signature · 1 line
1.7.9.5