Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 19 May 2015 14:34:02 +1000 (EST)
From:      Bruce Evans <brde@optusnet.com.au>
To:        Pedro Giffuni <pfg@freebsd.org>
Cc:        Bruce Evans <brde@optusnet.com.au>, src-committers@freebsd.org,  svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   Re: svn commit: r283088 - head/sys/ddb
Message-ID:  <20150519135341.R2157@besplex.bde.org>
In-Reply-To: <406A7AE3-1891-4B2C-B917-14C150EBBAB5@FreeBSD.org>
References:  <201505182227.t4IMRljx078812@svn.freebsd.org> <20150519113755.U1840@besplex.bde.org> <406A7AE3-1891-4B2C-B917-14C150EBBAB5@FreeBSD.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Mon, 18 May 2015, Pedro Giffuni wrote:

>> Il giorno 18/mag/2015, alle ore 20:48, Bruce Evans <brde@optusnet.com.au=
> ha scritto:
>>
>> On Mon, 18 May 2015, Pedro F. Giffuni wrote:
>>
>>> Log:
>>> ddb: stop boolean screaming.
>>>
>>> TRUE --> true
>>> FALSE--> false
>>>
>>> Hinted by:=09NetBSD
>>
>> This is not just churn to a style regression, but a type mismatch.
>
> It is an attempt to reduce differences with NetBSD.

For that, apply the reverse change to NetBSD.

> One of the complaints of hear from newcomers to the ddb code is that
> the format is old-fashioned (it still had pre-ANSI headers not long ago)
> and unmaintained.

It is fairly well maintained (not churned to unimprove its portability).
Why would newcomers want too look at it?

>>> Modified: head/sys/ddb/db_break.c
>>> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D
>>> --- head/sys/ddb/db_break.c=09Mon May 18 22:14:06 2015=09(r283087)
>>> +++ head/sys/ddb/db_break.c=09Mon May 18 22:27:46 2015=09(r283088)
>>> @@ -155,12 +155,12 @@ db_find_breakpoint_here(db_addr_t addr)
>>> =09return db_find_breakpoint(db_map_addr(addr), addr);
>>> }
>>>
>>> -static boolean_t=09db_breakpoints_inserted =3D TRUE;
>>> +static boolean_t=09db_breakpoints_inserted =3D true;
>>
>> This code hasn't been churned to use the boolean type.  It still uses
>> boolean_t, which is plain int.  TRUE and FALSE go with this type.  true
>> and false go with the boolean type.  This probably makes no difference,
>> because TRUE happens to be implemented with the same value as true and
>> there are lots of implicit versions between the types.
>
> Yes, I noticed the return types are still ints. It doesn=E2=80=99t look d=
ifficult
> to convert it to use a real boolean type.  In any case, I would prefer to=
 go
> forward (using bool) instead of reverting this change.

That wuld be sideways.

I forgot to mention (again) in my previous reply that boolean_t is a mistak=
e
by me.  KNF code doesn't even use the ! operator, but uses explicit
comparison with 0.  The boolean_t type and TRUE and FALSE are from Mach.
They were used mainly in ddb and vm, and are still almost never used in
kern.  I used to like typedefs and a typedef for boolean types, and didn't
know KNF very well, so in 1995 I moved the declaration of boolean_t from
Mach vm code to sys/types.h to try to popularize it.  This was a mistake.
Fortunately, it is still rarely used in core kernel code.

The boolean type is also almost never used for syscalls.  In POSIX.1-2001,
<stdbool.h> is inherited from C99, but is never used for any other POSIX
API.  Using it for syscalls would mainly cause portability problems.

>> The boolean type is almost useless since C's type system is too weak to
>> distinguish between plain int used as a boolean and pure boolean.  If
>> it were stronger, then it would complain about all the implicit conversi=
ons
>> between int and boolean, and the boolean type would be harder to use for
>> other reasons.
>
> And I would like that to happen, but it would probably break a lot of leg=
acy code.
> I thought boolean_t was a transition type.

It is the Mach spelling of a type suitable for holding boolean values.  The=
re
aren't many possible spellings, but even the limited spellings cause namesp=
ace
problems.  C99 uses the spelling _Bool for the basic type to keep away from
the application namespace.  Applications only get the spellings bool, true
and false if they include <stdbool.h>.  These spellings are very likely to
conflict with application spellings for a nonstandard implementations of th=
e
boolean type.  The kernel is not careful about this :-(.  Someone added
the pollution bool, true and false to sys/types.h.  Otherwise, your change
wouldn't have compiled.  The pollution for boolean_t is not as bad.
boolean_t is in the POSIX namespace for sys/types.h, and TRUE and FALSE are
only defined in sys/param.h.

It is interesting that true and false are macros of type int suitable for
use in cpp expressions, with values precisely 0 and 1.  They are just
like TRUE and FALSE, except they are specified in a standard while TRUE
and FALSE are not even documented in a man page AFAIK (in section 9 man
pages, some functions are documented as returning TRUE or FALSE, but what
these are is not documented).  This makes the boolean type system even
weaker than I thought, and your change not even a type error -- since
true and false don't have type bool, the compiler cannot do any extra
type checking for them.

Bruce
From owner-svn-src-all@FreeBSD.ORG  Tue May 19 05:06:19 2015
Return-Path: <owner-svn-src-all@FreeBSD.ORG>
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org
 [IPv6:2001:1900:2254:206a::19:1])
 (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
 (No client certificate requested)
 by hub.freebsd.org (Postfix) with ESMTPS id D2502E07
 for <svn-src-all@freebsd.org>; Tue, 19 May 2015 05:06:19 +0000 (UTC)
Received: from mail-wg0-x230.google.com (mail-wg0-x230.google.com
 [IPv6:2a00:1450:400c:c00::230])
 (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
 (Client CN "smtp.gmail.com",
 Issuer "Google Internet Authority G2" (verified OK))
 by mx1.freebsd.org (Postfix) with ESMTPS id 4DC41198A
 for <svn-src-all@freebsd.org>; Tue, 19 May 2015 05:06:19 +0000 (UTC)
Received: by wgjc11 with SMTP id c11so3914581wgj.0
 for <svn-src-all@freebsd.org>; Mon, 18 May 2015 22:06:17 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=eitanadler.com; s=0xdeadbeef;
 h=mime-version:sender:in-reply-to:references:from:date:message-id
 :subject:to:cc:content-type;
 bh=28g87T80/+z/BfUe6eEpOoXqm5Ms/NkoshrkCWKSnvY=;
 b=hUv4TZtrBSd6P4rX2OLbawhBn/IK2dPj92F3iSH3jrF58w9dYRk2XysdxueNg1XgI1
 W4sDsu6b1z+GqmymQaEp7/ajhaokHccym+QUZjS3Qxu9rcy37i2EridmIvA+qfeQnCNP
 ME/xb5DBv8JclgQMGnlO0+Z33hAYzIeQcJFpk=
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20130820;
 h=x-gm-message-state:mime-version:sender:in-reply-to:references:from
 :date:message-id:subject:to:cc:content-type;
 bh=28g87T80/+z/BfUe6eEpOoXqm5Ms/NkoshrkCWKSnvY=;
 b=ZgH2hB9iUKUtlBJq2vUQl8tCBU/ln2vEv3Cjfext2rwwlWjCW2nBS8LHcqCP+m069t
 vjEKUUlr2xs/R+d3CPNzPDTcEwf6dEm5CvT0cwDF4yOgGY8+krpE10bzT/5QsCVcpKSk
 0vbyQErIgYkYafSSGnHeJ7J6BwJMEDTyYIUIAMDSadi3N3G16ENUiVnt6ZcomL8D7dhf
 zLJe3nQXWGXKQzYlRo5RkkIw4oeP+77Yhysv6/s1sOET0YzkhO8P618cicWniFrAE9K0
 CbWNp2aU6URyiSjAPNYdWHtCysSOblAEm0og4qvE44ybI/NJmmeVI1Eg00KJqh6L7S6N
 XpHA==
X-Gm-Message-State: ALoCoQm8RXzYc8+xUtIXJ673jac5o5UQZjU335rFXJE3GbRyPZKeuyOki5RTT8GSQJi1eTLz2FRU
X-Received: by 10.194.200.228 with SMTP id jv4mr49493490wjc.157.1432011977645; 
 Mon, 18 May 2015 22:06:17 -0700 (PDT)
MIME-Version: 1.0
Sender: lists@eitanadler.com
Received: by 10.28.20.75 with HTTP; Mon, 18 May 2015 22:05:46 -0700 (PDT)
In-Reply-To: <CA08581F265A5567A799C4C2@ogg.in.absolight.net>
References: <201505151825.t4FIPnxJ099637@svn.freebsd.org>
 <CAJ-Vmomw3QeX4QfwN3ZH+cgJGbcJJT0LyjF8d+2EX0vExQzYog@mail.gmail.com>
 <059F2C65-F92D-445C-B603-0FAE0CAF976D@gmail.com>
 <1431877581.91685.49.camel@freebsd.org>
 <CAF6rxg=kNFBhDWY0VZKWUb=sVRc-XRtJVGOquEAX=jcdq_CkYA@mail.gmail.com>
 <7F73A915E7DF0EE8DC6149EC@atuin.in.mat.cc>
 <1431957864.91685.57.camel@freebsd.org>
 <64FE26BD563665E5F1B3D0C8@ogg.in.absolight.net>
 <CAPyFy2CJP4EPBw9jKgsiAzbgBcxpyYXkMa5F7SBV2uBjjw=F5Q@mail.gmail.com>
 <CA08581F265A5567A799C4C2@ogg.in.absolight.net>
From: Eitan Adler <eadler@freebsd.org>
Date: Mon, 18 May 2015 22:05:46 -0700
X-Google-Sender-Auth: l4nJSOGPfox2GbugWzXIGhZaZCI
Message-ID: <CAF6rxgnJ3K1LA2Fst8YsSjxFpDouT+itePJu8ouEeJoxo=JNfw@mail.gmail.com>
Subject: Re: svn commit: r282985 - in head/sys: arm/annapurna
 arm/annapurna/alpine arm/annapurna/alpine/hal arm/conf boot/fdt/dts/arm
To: Mathieu Arnold <m@absolight.fr>
Cc: Ed Maste <emaste@freebsd.org>, Ian Lepore <ian@freebsd.org>, 
 "src-committers@freebsd.org" <src-committers@freebsd.org>, 
 "svn-src-all@freebsd.org" <svn-src-all@freebsd.org>, 
 "svn-src-head@freebsd.org" <svn-src-head@freebsd.org>,
 Garrett Cooper <yaneurabeya@gmail.com>
Content-Type: text/plain; charset=UTF-8
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.20
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for &quot;
 user&quot; and &quot; projects&quot; \)" <svn-src-all.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/options/svn-src-all>,
 <mailto:svn-src-all-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-all/>;
List-Post: <mailto:svn-src-all@freebsd.org>
List-Help: <mailto:svn-src-all-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-all>,
 <mailto:svn-src-all-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Tue, 19 May 2015 05:06:20 -0000

On 18 May 2015 at 08:41, Mathieu Arnold <m@absolight.fr> wrote:
> +--On 18 mai 2015 10:52:29 -0400 Ed Maste <emaste@freebsd.org> wrote:
> | On 18 May 2015 at 10:11, Mathieu Arnold <m@absolight.fr> wrote:
> |>
> |> Mmmm, if this can be done only for base, and not for ports, sure, but
> |> ports need to be able to add patches with CRLF endings, because upstream
> |> software comes in all flavors, including CRLF files we need to be able
> |> to patch.
> |
> | Sure it could, we could configure it however we want.
> |
> | Note that we'll likely need to support CRLF in base anyway - one
> | obvious example is test cases for CRLF handling in various tools.  I'd
> | imagine we could add an SVN keyword like fbsd:crlf=yes, along the
> | lines of fbsd:nokeywords=yes.
> |
> | Do you know how common CRLF or partial CRLF files are in the ports
> | tree?  If it's only a handful that scheme could work there too.
>
> $ ag -l '\r' /usr/ports/|wc -l
>       95
>
> there's a bit more than a handful, but it could work, yes.  If you want to
> have a look at a typical one, /usr/ports/shells/ibsh/files/patch-Makefile
> :-)
>
> But I think Eitan was talking about Phabricator, in this case, it'd need to
> work there too.

The rule can be limited to the non-contrib portions of the source
repository.  If svn blocks the commit, and that's enough, that's okay,
but if it will help to have phabricator report these as well, I could
set that up.



-- 
Eitan Adler
Source, Ports, Doc committer
Bugmeister, Ports Security teams



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20150519135341.R2157>