[v2] jdupes 1.11.1 port to BusyBox

Jody Bruchon jody at jodybruchon.com
Fri Dec 21 04:12:13 UTC 2018


On 12/19/2018 8:16 AM, Tito wrote:
>
>
> On 11/12/18 18:29, Jody Bruchon wrote:
>> This updated version of the jdupes duplicate file finder port to 
>> BusyBox adds a whole host of feature exclusions that allow further 
>> reduction of the applet's size. Nearly all of the final actions 
>> performed by jdupes (deletion, linking, etc.) can be done by piping 
>> the output to a shell script anyway, though it's not as convenient or 
>> quick as having the program do it for you. All final actions other 
>> than printing match sets can now be disabled, and all of the progress 
>> bar code can now be tossed out as well.
>>
>> With the new exclusions available, a BusyBox defconfig with a fully 
>> stripped down jdupes weighs in just barely under 10K:
>>
>> $ size busybox_with*
>>     text    data     bss     dec     hex filename
>> 1009790    6763    3648 1020201   f9129 busybox_with_jdupes
>> 1000754    6747    3512 1011013   f6d45 busybox_with_jdupes_minimal
>>   991308    6731    3216 1001255   f4727 busybox_without_jdupes
>>
>> Modified time support being disabled will reduce the size of the 
>> heavily used per-file struct by a time_t and throws out time checks 
>> in a some "hot" code paths, speeding things up a bit more. The clear 
>> downside is that this opens the gates wide for TOCTTOU errors if 
>> chosen and I've noted that in the help text.
>>
> Hi,
> by looking at the code it seems not to be very busyboxified,
> no xmalloc, bb_error_msg, getopt32 nor any other libbb
> function, do you plan to use them?
>
> Ciao,
> Tito

I've now converted it to use several libbb functions including 
x[z]malloc and bb_error_msg_and_die, eliminating lots of fprintf/exit 
combos along the way. I haven't yet converted getopt_long to 
getopt32long. This is what the size output looks like after those changes:

$ size busybox*miscutils/jdupes.o
    text    data     bss     dec     hex filename
1005784    6755    3664 1016203   f818b busybox
1009790    6763    3648 1020201   f9129 busybox_with_jdupes
  991308    6731    3216 1001255   f4727 busybox_without_jdupes
   16945       8     392   17345    43c1 miscutils/jdupes.o

I've dropped 4K from the final binary. I'll get the getopt32long 
conversion done and re-submit.

Thanks!
Jody


More information about the busybox mailing list