Bug 7466

Summary: ubiupdatevol -t (truncate) parameter now incorrectly requires a value in BBx1.22.x
Product: Busybox Reporter: Phil <firehills99>
Component: OtherAssignee: unassigned
Status: RESOLVED FIXED    
Severity: minor CC: busybox-cvs
Priority: P5    
Version: 1.22.x   
Target Milestone: ---   
Hardware: PC   
OS: Linux   
Host: Target:
Build:
Attachments: potential patch to fix the issue?

Description Phil 2014-09-25 10:25:15 UTC
When Using BusyBox v1.22.1 ubiupdatevol truncate option now seems to require a size parameter.

~ # busybox ubiupdatevol /dev/ubi0_6 -t <THIS SHOULD WORK OK>
ubiupdatevol: option requires an argument -- 't'
BusyBox v1.22.1 (2014-09-25 02:24:52 BST) multi-call binary.

Usage: ubiupdatevol UBI_DEVICE [-t | [-s SIZE] IMG_FILE]

Update UBI volume

        -t      Truncate to zero size
        -s SIZE Size in bytes to resize to

~ #


This operation works OK in previous busybox (BusyBox v1.20.2)


For reference the full mtd-utils(1.5.1) ubiupdatevol specifically gives the -t option as an example without a size.

ubiupdatevol version 1.5.1 - a tool to write data to UBI volumes.

Usage: ubiupdatevol <UBI volume node file name> [-t] [-s <size>] [-h] [-V] [--truncate]
                        [--size=<size>] [--help] [--version] <image file>

Example 1: ubiupdatevol /dev/ubi0_1 fs.img - write file "fs.img" to UBI volume /dev/ubi0_1
Example 2: ubiupdatevol /dev/ubi0_1 -t - wipe out UBI volume /dev/ubi0_1

-t, --truncate             truncate volume (wipe it out)
-s, --size=<bytes>         bytes to read from input
    --skip=<bytes>         leading bytes to skip from input
-h, --help                 print help message
-V, --version              print program version
~ #


Thanks
Comment 1 Phil 2014-09-25 13:35:29 UTC
Created attachment 5684 [details]
potential patch to fix the issue?

I'm not so sure what I'm doing but the attached patch seems to fix the issue for me at least. 

Hopefully an experienced maintainer can take a look
Comment 2 Denys Vlasenko 2014-09-25 20:11:07 UTC
Fixed in git. Thanks!