Bug 6011 - e2fsprogs: return error when failed to populate fs
Summary: e2fsprogs: return error when failed to populate fs
Status: VERIFIED FIXED
Alias: None
Product: OE-Core
Classification: Build System, Metadata & Runtime
Component: core (show other bugs)
Version: 1.6
Hardware: x86 Multiple
: Medium+ normal
Target Milestone: 1.6 M5
Assignee: Robert Yang
QA Contact: Andra Necula
URL:
Whiteboard:
Depends on:
Blocks:
 
Reported: 2014-03-20 05:15 UTC by Robert Yang
Modified: 2014-09-04 07:07 UTC (History)
4 users (show)

See Also:
OS type for building Yocto: ---
Type of Regression: ---
Verified:
Documentation change: No (bug/feature does not impact docs)


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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.