Bug 6011

Summary: e2fsprogs: return error when failed to populate fs
Product: [Build System, Metadata & Runtime] OE-Core Reporter: Robert Yang <liezhi.yang>
Component: coreAssignee: Robert Yang <liezhi.yang>
Status: VERIFIED FIXED QA Contact: Andra Necula <andrax.g.necula>
Severity: normal    
Priority: Medium+ CC: andrax.g.necula, meta.mr.watcher, meta.watcher, richard.purdie
Version: 1.6   
Target Milestone: 1.6 M5   
Hardware: x86   
OS: Multiple   
Whiteboard:
OS type for building Yocto: --- Type of Regression: ---
Verified: Documentation change: No (bug/feature does not impact docs)

Description Robert Yang 2014-03-20 05:15:14 UTC
We need return retval when "mke2fs -d" failed, otherwise the "$?" would
be 0 which is misleading.
Comment 2 Andra Necula 2014-09-04 07:07:36 UTC
Hello,

We just made some tests related to this issue. Our way of testing was like this:
-	inserted an USB device (/dev/sdb) having a partition /dev/sdb1
-	created an empty directory (eg. teste)
-	ran against a non existent dir the command “mke2fs –d invalid_dir  /dev/sdb1” and obtained the desired result as on bug fix:
“
root@emenlow:/media/test/stick/teste# mke2fs -d invalid_dir /dev/sdb1  # invalid_dir is a non existent dir
...
Allocating group tables: done                           
Writing inode tables: done                           
Copying files into the device: populate_fs: No such file or directory while changing working directory to "invalid_dir"

Error while populating file system
root@emenlow:/media/test/stick/teste# echo $?
      2
“

However while performing our checks,  I observed something that I don’t know if it’s right or wrong:
-	even if the directory is empty, the process of creating root fs is starting and completing without error (and exit code is 0):

root@emenlow:/media/test/stick/teste# mke2fs -d . /dev/sdb1
...
root@emenlow:/media/test/stick/teste# echo $?
0
“

-	both in the case of empty dir and in case of non existing dir  the job of writing inode tables starts and completes successfully. This of course 
erases the content of inserted media. Shouldn’t be a check of content before?


Meanwhile I will mark this bug as verified.

Regards,
Andra N.