[PATCH] mtree should not output size if the file is not a regular file
Tim Kientzle
kientzle at acm.org
Tue Sep 10 03:38:02 UTC 2013
On Sep 9, 2013, at 4:51 PM, Christos Zoulas <christos at zoulas.com> wrote:
> On Sep 10, 1:21am, des at des.no (=?utf-8?Q?Dag-Erling_Sm=C3=B8rgrav?=) wrote:
> -- Subject: Re: [PATCH] mtree should not output size if the file is not a reg
>
> | Roll a large tarball (e.g. a complete FreeBSD installation). Copy it to
> | different machines with different filesystems. Untar and run mtree on
> | the result. Notice that you get different output on each machine
> | because they report different sizes for directories; one might report
> | the actual on-disk size (which might vary depending on past contents)
> | while the other might report the number of entries.
>
> Yes, I agree. I would like to note that the current NetBSD code looks like:
>
> if (keys & F_SIZE &&
> (flavor != F_NETBSD6 || S_ISREG(p->fts_statp->st_mode)))
>
> which means that F_NETBSD6 did not print this, and we recently changed
> it to print the size for compatibility with F_FREEBSD9... We also made
> the default F_MTREE format to print the size. So I guess the thing to
> do is change the code to:
>
> if (keys & F_SIZE &&
> (flavor == F_FREEBSD9 || S_ISREG(p->fts_statp->st_mode)))
DES is right: size should just be omitted for non-regular files.
Bug-for-bug compatibility can be taken too far.
I prefer Xin's original patch.
Tim
More information about the freebsd-current
mailing list