* [Buildroot] [PATCH 1/2] ext2.mk: ensure file system block count is not zero (0) @ 2017-04-29 16:01 J Evans 2017-04-29 16:01 ` [Buildroot] [PATCH 2/2] mke2img: add parameter sanity checks to prevent odd error messages from genext2.fs J Evans 2017-04-29 19:03 ` [Buildroot] [PATCH 1/2] ext2.mk: ensure file system block count is not zero (0) Thomas Petazzoni 0 siblings, 2 replies; 8+ messages in thread From: J Evans @ 2017-04-29 16:01 UTC (permalink / raw) To: buildroot Signed-off-by: J Evans <g4@novadsp.com> --- fs/ext2/ext2.mk | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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 -- 2.7.4 ^ permalink raw reply related [flat|nested] 8+ messages in thread
* [Buildroot] [PATCH 2/2] mke2img: add parameter sanity checks to prevent odd error messages from genext2.fs 2017-04-29 16:01 [Buildroot] [PATCH 1/2] ext2.mk: ensure file system block count is not zero (0) J Evans @ 2017-04-29 16:01 ` J Evans 2017-04-29 19:06 ` Thomas Petazzoni 2017-04-29 19:03 ` [Buildroot] [PATCH 1/2] ext2.mk: ensure file system block count is not zero (0) Thomas Petazzoni 1 sibling, 1 reply; 8+ messages in thread From: J Evans @ 2017-04-29 16:01 UTC (permalink / raw) To: buildroot Signed-off-by: J Evans <g4@novadsp.com> --- package/mke2img/mke2img | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/package/mke2img/mke2img b/package/mke2img/mke2img index b773aa9..c50dc66 100755 --- a/package/mke2img/mke2img +++ b/package/mke2img/mke2img @@ -44,6 +44,12 @@ main() { if [ -z "${image}" ]; then error "you must specify an output image file with '-o'\n" fi + if [ -z "${nb_blocks}" ]; then + error "Error: you must specify a file system block count with '-b'. This cannot be zero, e.g. 61440 == 60MB\n" + fi + if [ "${nb_blocks}" -eq 0 ]; then + error "Error: The file system block count size cannot be zero. e.g. 61440 == 60MB \n" + fi case "${gen}:${rev}" in 2:0|2:1|3:1|4:1) ;; -- 2.7.4 ^ permalink raw reply related [flat|nested] 8+ messages in thread
* [Buildroot] [PATCH 2/2] mke2img: add parameter sanity checks to prevent odd error messages from genext2.fs 2017-04-29 16:01 ` [Buildroot] [PATCH 2/2] mke2img: add parameter sanity checks to prevent odd error messages from genext2.fs J Evans @ 2017-04-29 19:06 ` Thomas Petazzoni 2017-04-30 9:25 ` Yann E. MORIN 0 siblings, 1 reply; 8+ messages in thread From: Thomas Petazzoni @ 2017-04-29 19:06 UTC (permalink / raw) To: buildroot Hello, On Sat, 29 Apr 2017 17:01:22 +0100, J Evans wrote: > + if [ -z "${nb_blocks}" ]; then > + error "Error: you must specify a file system block count with '-b'. This cannot be zero, e.g. 61440 == 60MB\n" > + fi Check this is useless: there is already error checking done by getopt itself, because the -b option *must* have an argument. Indeed, the current mke2img behaves like this: $ ./package/mke2img/mke2img -b mke2img: option 'b' expects a mandatory argument So it is already checked that ${nb_blocks} cannot be empty. > + if [ "${nb_blocks}" -eq 0 ]; then > + error "Error: The file system block count size cannot be zero. e.g. 61440 == 60MB \n" > + fi See my reply to the previous commit: I don't see why 0 should be checked specifically. Please explain in the commit log why it should be. Thanks! Thomas -- Thomas Petazzoni, CTO, Free Electrons Embedded Linux and Kernel engineering http://free-electrons.com ^ permalink raw reply [flat|nested] 8+ messages in thread
* [Buildroot] [PATCH 2/2] mke2img: add parameter sanity checks to prevent odd error messages from genext2.fs 2017-04-29 19:06 ` Thomas Petazzoni @ 2017-04-30 9:25 ` Yann E. MORIN 2017-04-30 9:32 ` Thomas Petazzoni 0 siblings, 1 reply; 8+ messages in thread From: Yann E. MORIN @ 2017-04-30 9:25 UTC (permalink / raw) To: buildroot Thomas, All, On 2017-04-29 21:06 +0200, Thomas Petazzoni spake thusly: > Hello, > > On Sat, 29 Apr 2017 17:01:22 +0100, J Evans wrote: > > > + if [ -z "${nb_blocks}" ]; then > > + error "Error: you must specify a file system block count with '-b'. This cannot be zero, e.g. 61440 == 60MB\n" Really, just state that it must be specified, this the value is explained in the help text. error "Error: you must specify a file system block count with '-b'.\n" However, please also update the help text at the end of the script,m to remove a hint about auto calculation: https://git.buildroot.org/buildroot/tree/package/mke2img/mke2img#n152 -b BLOCKS Create a filesystem of BLOCKS 1024-byte blocs. The default is to compute the required number of blocks. > > + fi > > Check this is useless: there is already error checking done by getopt > itself, because the -b option *must* have an argument. Indeed, the > current mke2img behaves like this: > > $ ./package/mke2img/mke2img -b > mke2img: option 'b' expects a mandatory argument > > So it is already checked that ${nb_blocks} cannot be empty. But if you don't pass the -b option, then nb_blocks *is* unset. Adding the check is correct in my opinion. > > + if [ "${nb_blocks}" -eq 0 ]; then > > + error "Error: The file system block count size cannot be zero. e.g. 61440 == 60MB \n" > > + fi > > See my reply to the previous commit: I don't see why 0 should be > checked specifically. Please explain in the commit log why it should be. Agreed, a zero size is like specifying any size that is too small to fit the content of target/. There is no way we can check that the given size is correct. zero if of course special, because we *know* it is incorrect. But since this is not the default value, the user would have explicitly set it to zero. Which is justa little tad stupid to begin with. As I previously said: I really don't see the point of checking that the size is not zero. Just keep the text tht nb_blocks is set, though, because it is required. Regards, Yann E. MORIN. -- .-----------------.--------------------.------------------.--------------------. | Yann E. MORIN | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: | | +33 662 376 056 | Software Designer | \ / CAMPAIGN | ___ | | +33 223 225 172 `------------.-------: X AGAINST | \e/ There is no | | http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL | v conspiracy. | '------------------------------^-------^------------------^--------------------' ^ permalink raw reply [flat|nested] 8+ messages in thread
* [Buildroot] [PATCH 2/2] mke2img: add parameter sanity checks to prevent odd error messages from genext2.fs 2017-04-30 9:25 ` Yann E. MORIN @ 2017-04-30 9:32 ` Thomas Petazzoni 0 siblings, 0 replies; 8+ messages in thread From: Thomas Petazzoni @ 2017-04-30 9:32 UTC (permalink / raw) To: buildroot Hello, On Sun, 30 Apr 2017 11:25:33 +0200, Yann E. MORIN wrote: > > $ ./package/mke2img/mke2img -b > > mke2img: option 'b' expects a mandatory argument > > > > So it is already checked that ${nb_blocks} cannot be empty. > > But if you don't pass the -b option, then nb_blocks *is* unset. > > Adding the check is correct in my opinion. Ah, yes agreed. Thomas -- Thomas Petazzoni, CTO, Free Electrons Embedded Linux and Kernel engineering http://free-electrons.com ^ permalink raw reply [flat|nested] 8+ messages in thread
* [Buildroot] [PATCH 1/2] ext2.mk: ensure file system block count is not zero (0) 2017-04-29 16:01 [Buildroot] [PATCH 1/2] ext2.mk: ensure file system block count is not zero (0) J Evans 2017-04-29 16:01 ` [Buildroot] [PATCH 2/2] mke2img: add parameter sanity checks to prevent odd error messages from genext2.fs J Evans @ 2017-04-29 19:03 ` Thomas Petazzoni 2017-04-30 9:18 ` Yann E. MORIN 1 sibling, 1 reply; 8+ messages in thread From: Thomas Petazzoni @ 2017-04-29 19:03 UTC (permalink / raw) To: buildroot 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 -- Thomas Petazzoni, CTO, Free Electrons Embedded Linux and Kernel engineering http://free-electrons.com ^ permalink raw reply [flat|nested] 8+ messages in thread
* [Buildroot] [PATCH 1/2] ext2.mk: ensure file system block count is not zero (0) 2017-04-29 19:03 ` [Buildroot] [PATCH 1/2] ext2.mk: ensure file system block count is not zero (0) Thomas Petazzoni @ 2017-04-30 9:18 ` Yann E. MORIN 2017-04-30 12:18 ` jerry at chordia.co.uk 0 siblings, 1 reply; 8+ messages in thread From: Yann E. MORIN @ 2017-04-30 9:18 UTC (permalink / raw) To: buildroot 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. -- .-----------------.--------------------.------------------.--------------------. | Yann E. MORIN | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: | | +33 662 376 056 | Software Designer | \ / CAMPAIGN | ___ | | +33 223 225 172 `------------.-------: X AGAINST | \e/ There is no | | http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL | v conspiracy. | '------------------------------^-------^------------------^--------------------' ^ permalink raw reply [flat|nested] 8+ messages in thread
* [Buildroot] [PATCH 1/2] ext2.mk: ensure file system block count is not zero (0) 2017-04-30 9:18 ` Yann E. MORIN @ 2017-04-30 12:18 ` jerry at chordia.co.uk 0 siblings, 0 replies; 8+ messages in thread From: jerry at chordia.co.uk @ 2017-04-30 12:18 UTC (permalink / raw) To: buildroot 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. ^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2017-04-30 12:18 UTC | newest] Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2017-04-29 16:01 [Buildroot] [PATCH 1/2] ext2.mk: ensure file system block count is not zero (0) J Evans 2017-04-29 16:01 ` [Buildroot] [PATCH 2/2] mke2img: add parameter sanity checks to prevent odd error messages from genext2.fs J Evans 2017-04-29 19:06 ` Thomas Petazzoni 2017-04-30 9:25 ` Yann E. MORIN 2017-04-30 9:32 ` Thomas Petazzoni 2017-04-29 19:03 ` [Buildroot] [PATCH 1/2] ext2.mk: ensure file system block count is not zero (0) Thomas Petazzoni 2017-04-30 9:18 ` Yann E. MORIN 2017-04-30 12:18 ` jerry at chordia.co.uk
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.