diff mbox

[1/2] ext2.mk: ensure file system block count is not zero (0)

Message ID 1493481682-128366-1-git-send-email-g4@novadsp.com
State Rejected
Headers show

Commit Message

J Evans April 29, 2017, 4:01 p.m. UTC
Signed-off-by: J Evans <g4@novadsp.com>
---
 fs/ext2/ext2.mk | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Comments

Thomas Petazzoni April 29, 2017, 7:03 p.m. UTC | #1
Hello,

On Sat, 29 Apr 2017 17:01:21 +0100, J Evans wrote:

> -ifneq ($(strip $(BR2_TARGET_ROOTFS_EXT2_BLOCKS)),0)
> +ifeq ($(strip $(BR2_TARGET_ROOTFS_EXT2_BLOCKS)),0)
> +$(error BR2_TARGET_ROOTFS_EXT2_BLOCKS cannot be zero (0))
> +else
>  EXT2_OPTS += -b $(BR2_TARGET_ROOTFS_EXT2_BLOCKS)
>  endif

What is the motivation for checking that the size is not zero? Zero is
like any other size too small to contain the target directory contents,
so I don't see why we would add a specific check for it.

Your commit log unfortunately only explains *what* the commit is doing
(which is obvious by reading the code) but not *why* this change is
necessary.

Thanks!

Thomas
Yann E. MORIN April 30, 2017, 9:18 a.m. UTC | #2
J, Thomas, All,

On 2017-04-29 21:03 +0200, Thomas Petazzoni spake thusly:
> On Sat, 29 Apr 2017 17:01:21 +0100, J Evans wrote:
> 
> > -ifneq ($(strip $(BR2_TARGET_ROOTFS_EXT2_BLOCKS)),0)
> > +ifeq ($(strip $(BR2_TARGET_ROOTFS_EXT2_BLOCKS)),0)
> > +$(error BR2_TARGET_ROOTFS_EXT2_BLOCKS cannot be zero (0))
> > +else
> >  EXT2_OPTS += -b $(BR2_TARGET_ROOTFS_EXT2_BLOCKS)
> >  endif
> 
> What is the motivation for checking that the size is not zero? Zero is
> like any other size too small to contain the target directory contents,
> so I don't see why we would add a specific check for it.

I agree, and that's exactly what I said in my review to the previous
iteration of the patch.

Just remove the check and keep the line:

    EXT2_OPTS += -b $(BR2_TARGET_ROOTFS_EXT2_BLOCKS)

Regards,
Yann E. MORIN.
jerry@chordia.co.uk April 30, 2017, 12:18 p.m. UTC | #3
Yann, all

> 
> Just remove the check and keep the line:
> 
>     EXT2_OPTS += -b $(BR2_TARGET_ROOTFS_EXT2_BLOCKS)

Yes, ideal. That will satisfy us both and (most importantly) make sure the
user cannot get this otherwise hard to debug error:

"genext2fs: Too many arguments. Try --help or else see the man page." 

BTW many thanks for patience etc. with this shower of patches.

BR,

Jerry.
diff mbox

Patch

diff --git a/fs/ext2/ext2.mk b/fs/ext2/ext2.mk
index 30f1d17..3a0c764 100644
--- a/fs/ext2/ext2.mk
+++ b/fs/ext2/ext2.mk
@@ -6,7 +6,9 @@ 
 
 EXT2_OPTS = -G $(BR2_TARGET_ROOTFS_EXT2_GEN) -R $(BR2_TARGET_ROOTFS_EXT2_REV)
 
-ifneq ($(strip $(BR2_TARGET_ROOTFS_EXT2_BLOCKS)),0)
+ifeq ($(strip $(BR2_TARGET_ROOTFS_EXT2_BLOCKS)),0)
+$(error BR2_TARGET_ROOTFS_EXT2_BLOCKS cannot be zero (0))
+else
 EXT2_OPTS += -b $(BR2_TARGET_ROOTFS_EXT2_BLOCKS)
 endif