[PATCH v2] tst-tzset: output reason when creating 4GiB file fails

Stafford Horne shorne@gmail.com
Wed Nov 3 20:30:27 GMT 2021


On Wed, Nov 03, 2021 at 12:14:52PM -0700, Paul Eggert wrote:
> On 11/2/21 16:31, Stafford Horne via Libc-alpha wrote:
> > +   {
> > +     printf ("creating timezone file of size: %" PRId64 "MiB failed.\n",
> > +	     size / (1024 * 1024));
> 
> Why not simply print the size in bytes? Converting to MiB outputs less
> information due to rounding, and is hardly worth the trouble here. Other
> than that, looks fine.

Hi Paul,

The reason for the divide by (1024 * 1024) it to make it easier to see where the
failure is at a glance.

The call to test_tz_file is done two times:

  test_tz_file (64 * 1024 * 1024);

  test_tz_file (4LL * 1024 * 1024 * 1024 - 6);

For me, it's a lot easier to tell the different between 2 and 4 digits (64MiB
and 4096MiB) than the bigger numbers.  The information lost is not too important
considering the test, in my opinion.

-Stafford


More information about the Libc-alpha mailing list