svn commit: r347953 - head/cddl/contrib/opensolaris/cmd/zfs

Bruce Evans brde at optusnet.com.au
Sat May 18 15:09:47 UTC 2019


On Sat, 18 May 2019, Toomas Soome wrote:

>> On 18 May 2019, at 15:37, Alexey Dokuchaev <danfe at freebsd.org> wrote:
>>
>> On Sat, May 18, 2019 at 12:27:22PM +0000, Allan Jude wrote:
>>> New Revision: 347953
>>> URL: https://svnweb.freebsd.org/changeset/base/347953
>>>
>>> Log:
>>>  MFV/ZoL: `zfs userspace` ignored all unresolved UIDs after the first
>>>
>>>  zfsonlinux/zfs at 88cfff182432e4d1c24c877f33b47ee6cf109eee
>>>
>>>  zfs_main: fix `zfs userspace` squashing unresolved entries
>>>
>>> ...
>>> @@ -2368,10 +2369,12 @@ us_compare(const void *larg, const void *rarg, void *u
>>> 				if (rv64 != lv64)
>>> 					rc = (rv64 < lv64) ? 1 : -1;
>>> 			} else {
>>> -				(void) nvlist_lookup_string(lnvl, propname,
>>> -				    &lvstr);
>>> -				(void) nvlist_lookup_string(rnvl, propname,
>>> -				    &rvstr);
>>> +				if ((nvlist_lookup_string(lnvl, propname,
>>> +						&lvstr) == ENOENT) ||
>>> +				    (nvlist_lookup_string(rnvl, propname,
>>> +						&rvstr) == ENOENT)) {
>>> +					goto compare_nums;
>>> +				}
>>
>> Another thing not to like about ZoL: their completely bogus code style
>> and formatting practices (look at those "&rvstr) == ENOENT").  If they
>> are going to listen to us, can we at least try to convince them not to
>> break existing, much FreeBSD-like formatting?
>
> Actually it is required to use the proper cstyle… https://github.com/zfsonlinux/zfs/blob/master/.github/CONTRIBUTING.md#style-guides <https://github.com/zfsonlinux/zfs/blob/master/.github/CONTRIBUTING.md#style-guides>
>
> Therefore bogus style is bug.

Indeed, the change was away from the proper cstyle.

Old zfs code is closer to KNF than most FreeBSD code, perhaps because
its cstyle guide is better than style(9) and is actually followed.  It
requires 4-space continuation indents the same as KNF, but these were
broken in the patch.  It requires casts to not be followed by a blank
(i.e., space), except, unfortunately, for function calls whose return
values are ignored.  So the old code above conformed to cstyle but not
to style(9) since it has spaces after "(void)" but otherwise conforms
to KNF.

The cstyle pdf in the above url was written in 1993 and last updated
in 1996.  Its age would be a feature, except it has only primitive
support for C90 (it never mentions "prototype" or ISO C, but has a
couple of examples of "ANSI" function definitions).  So it isn't
actually better than style(9), and I doubt that anyone actually follows
all of it.  Especially its requirement to support K&R in headers and its
examples of incomplete K&R-compatible declarations.

Bruce


More information about the svn-src-head mailing list