Subject: bug#49994: upgrade: have "-s" of 'ls' display alloc'd sizes for specified "--block-size"

From: L A Walsh <[email-masked]>
Date: Tue, 10 Aug 2021 23:56:08 -0700

How can I find all perl source files under the
perl source tree sorted by size + displayed 
w/binary-metric prefixes.  I wanted to look for
a good sample for _some_ specific size (not sure
of the size until I'd looked through a few).

I got close using:
find -iname \*.pl |sed 's!./!!' |xargs /usr/bin/ls --block-size=1 -1dhsS

That gave 577 lines of output, but only displaying the 1st entry
of same-size, consecutive entries that only has 15 unique sizes:

312K lib/perl5db.pl
200K lib/Unicode/Collate/Locale/ja.pl
100K lib/Unicode/Collate/Locale/zh_pin.pl
 96K ext/XS-APItest/t/utf8_warn_base.pl
 36K regen/opcode.pl
 32K ext/DynaLoader/DynaLoader_pm.PL
 28K regen/feature.pl
 24K ext/XS-APItest/t/handy_base.pl
 20K Porting/checkURL.pl
 16K Porting/corelist.pl
 12K t/lib/dbmt_common.pl
8.0K dist/lib/lib_pm.PL
4.0K cpan/Pod-Simple/t/ascii_order.pl
4.0K t/run/dtrace.pl

Unfortunately, the "-s" param on 'ls' drops 99.98% of 
the size info.  If the -s parameter displayed allocated
space for a file on a device with the block-size 
as specified on the command line (useful for determining
how much space the files will take on some device
with a finer block-size).

Using the block size as specified by the user gives
279 uniquely-sized entries losing no information (0%)
on the sizes of the files, with only my elision
of names for the sake of less verbosity

310K  lib/perl5db.pl
197K  cpan/Unicode-Collate/Collate/Locale/ja.pl
138K  regen/mk_invlists.pl
126K  Porting/bisect-runner.pl
...
53.3K win32/bin/search.pl
52.1K cpan/IO-Compress/t/compress/generic.pl
49.9K t/test.pl
46.4K utils/perlbug.PL
...
17.4K Porting/pod_lib.pl
17.1K Porting/add-package.pl
....
6.7K  dist/Devel-PPPort/Makefile.PL
6.6K  cpan/Sys-Syslog/Makefile.PL
6.5K  cpan/podlators/Makefile.PL
5.5K  cpan/Unicode-Collate/Collate/Locale/da.pl
5.4K  symbian/makesis.pl
...
1.2K  ext/Hash-Util/Makefile.PL
1.1K  win32/bin/perlglob.pl
1.0K  ext/File-Glob/Makefile.PL
 997  cpan/Unicode-Collate/Makefile.PL
 983  cpan/Unicode-Collate/Collate/Locale/mk.pl
...
 125  dist/Time-HiRes/hints/sco.pl
 110  ext/VMS-DCLsym/Makefile.PL
 104  dist/Time-HiRes/hints/dynixptx.pl
 101  cpan/DB_File/hints/dynixptx.pl
  97  ext/POSIX/hints/mint.pl
  94  dist/IO/hints/sco.pl
....
  11  symbian/uid.pl
   6  t/op/svleak.pl
   3  t/run/dtrace.pl
   2  cpan/Module-Load-Conditional/t/to_load/LoadMe.pl

--------------------------

Perhaps the '-s' option in ls could pay attention to
the user-specified block-size?