Re: [PATCH] mtree should not output size if the file is not a regular file

From: Brooks Davis <brooks_at_freebsd.org>
Date: Sun, 22 Sep 2013 15:57:05 -0500
On Tue, Sep 10, 2013 at 08:00:02AM +0200, Matthias Andree wrote:
> Am 10.09.2013 01:51, schrieb Christos Zoulas:
> > 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)))
> 
> Uh, does that flavor == F_FREEBSD9 solve a real problem?  Or is it just
> to reflect some syntax without proper semantics?
> 
> Or is this just gratuitious because someone else does nonsense we need
> to do it, too?
> 
> Or is it required to cater for expectations on the other end (when
> reading such an mtree description)?
> 
> If not, let's just drop the size where it's meaningless.  It's meant for
> the next major update, after all.  If necessary, bump the OSREVISION.

The intent of flavors is to allow the comparison of mtree output across
versions (where reasonably practical).  For things like showing size on
all file types, it's trivial to get mostly right so I feel it's useful.
For things like the nanosecond formatting bug fixed long ago in FreeBSD
and recently in NetBSD, the only option is breaking compatibility so
that's what was done.

I agree with the argument that we shouldn't print sizes for most
non-regular files and think we should make this change before FreeBSD
10.0.

-- Brooks

Received on Sun Sep 22 2013 - 18:57:12 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:40:41 UTC