Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 27 Dec 2023 08:48:16 -0700
From:      Warner Losh <imp@bsdimp.com>
To:        Alexey Dokuchaev <danfe@freebsd.org>
Cc:        Konstantin Belousov <kostikbel@gmail.com>, Kyle Evans <kevans@freebsd.org>, src-committers@freebsd.org,  dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org
Subject:   Re: git: 6ac7c9f06ae9 - main - daemon: remove redundant parameter from listen_child()
Message-ID:  <CANCZdfqhdx9mG2zogBQEz3%2BAGTrf7F7bConf-b4R40BjzH6MqA@mail.gmail.com>
In-Reply-To: <ZYxDXbj50bjYrxC0@FreeBSD.org>
References:  <202312270608.3BR688vs024888@gitrepo.freebsd.org> <ZYw5cGZAuLSbO8AW@kib.kiev.ua> <ZYxDXbj50bjYrxC0@FreeBSD.org>

next in thread | previous in thread | raw e-mail | index | archive | help
--000000000000dc94b3060d7fbad0
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

On Wed, Dec 27, 2023 at 8:31=E2=80=AFAM Alexey Dokuchaev <danfe@freebsd.org=
> wrote:

> On Wed, Dec 27, 2023 at 04:49:20PM +0200, Konstantin Belousov wrote:
> > On Wed, Dec 27, 2023 at 06:08:08AM +0000, Kyle Evans wrote:
> > > commit 6ac7c9f06ae9b7ef070c1f8a57dcc52be4dd45b7
> > >
> > >   daemon: remove redundant parameter from listen_child()
> > >
> > >   state already contains pipe fd
> > > ...
> > > @@ -448,9 +448,7 @@ daemon_eventloop(struct daemon_state *state)
> > >                                     /* child is dead, read all until
> EOF */
> > >                                     state->pid =3D -1;
> > >                                     state->mode =3D MODE_NOCHILD;
> > > -                                   while
> (listen_child(state->pipe_fd[0],
> > > -                                       state))
> > > -                                           ;
> > > +                                   while (listen_child(state));
> >
> > This line is the style regression.
>
> We've seen this before and I reckon these regressions would keep happenin=
g
> when semicolon is put on the new line by itself alone.  This would be les=
s
> likely to happen and makes the intention more obvious to say ``continue;'=
'.
>

fwiw, that was the recommendation of the 'old unix hands' on USENET
in the mid 80s.  It made the intention clear. I was told, but never
encountered,
that some linting tools will warn about the above style but not while (foo)
continue;
and so that's been my personal style ever since. I've debugged lots of code
that
used this style, and it's a bugger to sort out if the indentation is
correct and the ;
is intended at the end of the line, or if it was intended...

Warner

--000000000000dc94b3060d7fbad0
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div dir=3D"ltr"><br></div><br><div class=3D"gmail_quote">=
<div dir=3D"ltr" class=3D"gmail_attr">On Wed, Dec 27, 2023 at 8:31=E2=80=AF=
AM Alexey Dokuchaev &lt;<a href=3D"mailto:danfe@freebsd.org">danfe@freebsd.=
org</a>&gt; wrote:<br></div><blockquote class=3D"gmail_quote" style=3D"marg=
in:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1e=
x">On Wed, Dec 27, 2023 at 04:49:20PM +0200, Konstantin Belousov wrote:<br>
&gt; On Wed, Dec 27, 2023 at 06:08:08AM +0000, Kyle Evans wrote:<br>
&gt; &gt; commit 6ac7c9f06ae9b7ef070c1f8a57dcc52be4dd45b7<br>
&gt; &gt; <br>
&gt; &gt;=C2=A0 =C2=A0daemon: remove redundant parameter from listen_child(=
)<br>
&gt; &gt; <br>
&gt; &gt;=C2=A0 =C2=A0state already contains pipe fd<br>
&gt; &gt; ...<br>
&gt; &gt; @@ -448,9 +448,7 @@ daemon_eventloop(struct daemon_state *state)<=
br>
&gt; &gt;=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0/* child =
is dead, read all until EOF */<br>
&gt; &gt;=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0state-&gt=
;pid =3D -1;<br>
&gt; &gt;=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0state-&gt=
;mode =3D MODE_NOCHILD;<br>
&gt; &gt; -=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0while (listen=
_child(state-&gt;pipe_fd[0],<br>
&gt; &gt; -=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0state))<br>
&gt; &gt; -=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0;<br>
&gt; &gt; +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0while (listen=
_child(state));<br>
&gt; <br>
&gt; This line is the style regression.<br>
<br>
We&#39;ve seen this before and I reckon these regressions would keep happen=
ing<br>
when semicolon is put on the new line by itself alone.=C2=A0 This would be =
less<br>
likely to happen and makes the intention more obvious to say ``continue;&#3=
9;&#39;.<br></blockquote><div><br></div><div>fwiw, that was the recommendat=
ion of the &#39;old unix hands&#39; on USENET</div><div>in the mid 80s.=C2=
=A0 It made the intention clear. I was told, but never encountered,</div><d=
iv>that some linting tools will warn about the above style but not while (f=
oo) continue;</div><div>and so that&#39;s been my personal style ever since=
. I&#39;ve debugged lots of code that</div><div>used this style, and it&#39=
;s a bugger to sort out if the indentation is correct and the ;</div><div>i=
s intended at the end of the line, or if it was intended...</div><div><br><=
/div><div>Warner</div></div></div>

--000000000000dc94b3060d7fbad0--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CANCZdfqhdx9mG2zogBQEz3%2BAGTrf7F7bConf-b4R40BjzH6MqA>