On Tue, Jun 22, 2021 at 2:08 PM Rob Landley <[email protected]> wrote: > On 6/21/21 5:19 PM, Denys Vlasenko wrote: > > Looking at toybox's help texts, I noticed a few more: > > > > free [-bkmgt] > > Display the total, free and used amount of physical memory and > > swap space. > > -bkmg*t Output units (default is bytes) > > ^^^^^^^ in procps-ng 3.3.15, "free -t" is not "terabytes", it's --total > > Probably an accident. (The original submission just had -bkmg and no other > options, I probably saw -t in the old one line --help output and added what it > "obviously meant" when doing a cleanup pass, otherwise I would have added > -ped too). > > Nobody's mentioned it before now because the command's not in SUSv4, not in > LSB > 4.1, and its output is harder for scripts to parse than /proc/meminfo: > > $ echo $(($(sed -nE 's/^(Mem|Swap)Total:[ \t]*([0-9]*).*/+\2/p' > /proc/meminfo))) > 33006412 > > I tend to wait for people to show up with a complaint attached to a real-world > use case and do lazy-binding decision making then. Now that somebody's showed > up > who cares, would: > > A) always showing total > B) implementing --total longopt without the -t short option > C) changing -t to show total instead of terabytes > D) removing -t > > be less unpleasant?
C or D. IOW: avoid having an incompatible option. > To me, option C is the worst because that's INTERNALLY INCONSISTENT, which is > a > thing toybox tries to avoid being: And dd options style is internally inconsistent with most of Unix utilities. Perfectionism is not achievable, real-world evolution of APIs ends up with inconsistencies like that. > But this is not a widely used command (because /proc/meminfo exists), and > systems too small to have /proc mounted generally already know exactly how > much > memory they have and/or do their own sysinfo() call in a monolithic app, so > you're the first person to care enough to mention it. > > > hexedit FILE > > Hexadecimal file editor/viewer. All changes are written to > > disk immediately. > > -r Read only (display but don't edit) > > ^^^^^^^ hexedit 1.5 has no such opt > > So you're saying that an interactive GUI utility (which cannot be used in a > non-interactive mode) may not be compatible with existing shell scripts. I'm > not > convinced this issue is why? Just an observation. I'm not saying you must remove -r. _______________________________________________ busybox mailing list [email protected] http://lists.busybox.net/mailman/listinfo/busybox
