Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 13 Mar 2023 23:03:33 -0600
From:      Warner Losh <imp@bsdimp.com>
To:        Jessica Clarke <jrtc27@freebsd.org>
Cc:        Warner Losh <imp@freebsd.org>, src-committers <src-committers@freebsd.org>,  "<dev-commits-src-all@freebsd.org>" <dev-commits-src-all@freebsd.org>, dev-commits-src-main@freebsd.org
Subject:   Re: git: adeca21464d2 - main - Add GNU glibc compatible secure_getenv
Message-ID:  <CANCZdfp-r8H4QYsFWgdWzgZCDcRGztWm3Mmbs0qo36TLARX45A@mail.gmail.com>
In-Reply-To: <BE0076A3-EF34-461F-805A-E193372415B3@freebsd.org>
References:  <202303140419.32E4Jtsd058392@gitrepo.freebsd.org> <E40E7886-0EFC-4538-887F-ED067CB6FFFB@freebsd.org> <CANCZdfq3_3xS1tac6t6db-rx%2B0%2Ba8tCvGjmH0Rt=Sh9=Y7T2bQ@mail.gmail.com> <BE0076A3-EF34-461F-805A-E193372415B3@freebsd.org>

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

On Mon, Mar 13, 2023, 10:45 PM Jessica Clarke <jrtc27@freebsd.org> wrote:

> On 14 Mar 2023, at 04:37, Warner Losh <imp@bsdimp.com> wrote:
> >
> >
> >
> > On Mon, Mar 13, 2023, 10:21 PM Jessica Clarke <jrtc27@freebsd.org>
> wrote:
> > On 14 Mar 2023, at 04:19, Warner Losh <imp@FreeBSD.org> wrote:
> > >
> > > The branch main has been updated by imp:
> > >
> > > URL:
> https://cgit.FreeBSD.org/src/commit/?id=3Dadeca21464d25bc61f98968a5c1e76a=
b3c808ae4
> > >
> > > commit adeca21464d25bc61f98968a5c1e76ab3c808ae4
> > > Author:     lucy <seafork@disroot.org>
> > > AuthorDate: 2023-03-13 22:01:12 +0000
> > > Commit:     Warner Losh <imp@FreeBSD.org>
> > > CommitDate: 2023-03-14 04:19:24 +0000
> > >
> > >    Add GNU glibc compatible secure_getenv
> > >
> > >    Add mostly glibc and msl compatible secure_getenv. Return NULL if
> > >    issetugid() indicates the process is tainted, otherwise getenv(x).
> The
> > >    rational behind this is the fact that many Linux applications use
> this
> > >    function instead of getenv() as it's widely consider a, "best
> > >    practice".
> > >
> > >    Reviewed by: imp, mjg (feedback)
> > >    Pull Request: https://github.com/freebsd/freebsd-src/pull/686
> > >    Signed-off-by: Lucy Marsh <seafork@disroot.org>
> > > ---
> > > include/stdlib.h             |  1 +
> > > lib/libc/stdlib/Makefile.inc |  4 ++--
> > > lib/libc/stdlib/Symbol.map   |  1 +
> > > lib/libc/stdlib/getenv.3     | 26 +++++++++++++++++++++++++-
> > > lib/libc/stdlib/getenv.c     | 12 ++++++++++++
> > > 5 files changed, 41 insertions(+), 3 deletions(-)
> > >
> > > diff --git a/include/stdlib.h b/include/stdlib.h
> > > index 01629ed84a11..c41e8704e810 100644
> > > --- a/include/stdlib.h
> > > +++ b/include/stdlib.h
> > > @@ -111,6 +111,7 @@ void       qsort(void *, size_t, size_t,
> > >           int (* _Nonnull)(const void *, const void *));
> > > int    rand(void);
> > > void  *realloc(void *, size_t) __result_use_check __alloc_size(2);
> > > +char *secure_getenv(const char *);
> > > void   srand(unsigned);
> > > double         strtod(const char * __restrict, char ** __restrict);
> > > float  strtof(const char * __restrict, char ** __restrict);
> > > diff --git a/lib/libc/stdlib/Makefile.inc
> b/lib/libc/stdlib/Makefile.inc
> > > index 8ace2c051b82..964e7ce30594 100644
> > > --- a/lib/libc/stdlib/Makefile.inc
> > > +++ b/lib/libc/stdlib/Makefile.inc
> > > @@ -46,8 +46,8 @@ MAN+=3D       a64l.3 abort.3 abs.3 alloca.3 atexit.=
3
> atof.3 \
> > > MLINKS+=3Da64l.3 l64a.3 a64l.3 l64a_r.3
> > > MLINKS+=3Datol.3 atoll.3
> > > MLINKS+=3Dexit.3 _Exit.3
> > > -MLINKS+=3Dgetenv.3 clearenv.3 getenv.3 putenv.3 getenv.3 setenv.3 \
> > > -     getenv.3 unsetenv.3
> > > +MLINKS+=3Dgetenv.3 clearenv.3 getenv.3 putenv.3 getenv.3
> secure_getenv.3 \
> > > +     getenv.3 setenv.3 getenv.3 unsetenv.3
> > > MLINKS+=3Dgetopt_long.3 getopt_long_only.3
> > > MLINKS+=3Dhcreate.3 hdestroy.3 hcreate.3 hsearch.3
> > > MLINKS+=3Dhcreate.3 hcreate_r.3 hcreate.3 hdestroy_r.3 hcreate.3
> hsearch_r.3
> > > diff --git a/lib/libc/stdlib/Symbol.map b/lib/libc/stdlib/Symbol.map
> > > index 9d2944fdb7e9..a105f781734d 100644
> > > --- a/lib/libc/stdlib/Symbol.map
> > > +++ b/lib/libc/stdlib/Symbol.map
> > > @@ -128,6 +128,7 @@ FBSD_1.6 {
> > > FBSD_1.7 {
> > >       clearenv;
> > >       qsort_r;
> > > +     secure_getenv;
> > > };
> > >
> > > FBSDprivate_1.0 {
> > > diff --git a/lib/libc/stdlib/getenv.3 b/lib/libc/stdlib/getenv.3
> > > index 5566d7b01dcd..93c0d2ada6ad 100644
> > > --- a/lib/libc/stdlib/getenv.3
> > > +++ b/lib/libc/stdlib/getenv.3
> > > @@ -32,13 +32,14 @@
> > > .\"     @(#)getenv.3  8.2 (Berkeley) 12/11/93
> > > .\" $FreeBSD$
> > > .\"
> > > -.Dd November 7, 2021
> > > +.Dd March 13, 2023
> > > .Dt GETENV 3
> > > .Os
> > > .Sh NAME
> > > .Nm clearenv ,
> > > .Nm getenv ,
> > > .Nm putenv ,
> > > +.Nm secure_getenv ,
> > > .Nm setenv ,
> > > .Nm unsetenv
> > > .Nd environment variable functions
> > > @@ -50,6 +51,8 @@
> > > .Fn clearenv "void"
> > > .Ft char *
> > > .Fn getenv "const char *name"
> > > +.Ft char *
> > > +.Fn secure_getenv "const char *name"
> > > .Ft int
> > > .Fn setenv "const char *name" "const char *value" "int overwrite"
> > > .Ft int
> > > @@ -78,6 +81,20 @@ to by the
> > > .Fn getenv
> > > function.
> > > .Pp
> > > +The GNU-specific function,
> >
> > I don=E2=80=99t think it is now?..
> >
> > Yes...
> >
> > > +.Fn secure_getenv
> > > +wraps the
> > > +.Fn getenv
> > > +function to prevent it from being run in "secure execution".
> > > +Unlike in glibc,
> > > +.Fn secure_getenv
> > > +only checks if the
> > > +.Fa setuid
> > > +and
> > > +.Fa setgid
> > > +bits have been set or changed.
> > > +These checks are subject to extension and change.
> > > +.Pp
> > > The
> > > .Fn setenv
> > > function inserts or resets the environment variable
> > > @@ -139,6 +156,13 @@ is not in the current environment,
> > > .Dv NULL
> > > is returned.
> > > .Pp
> > > +The
> > > +.Fn secure_getenv
> > > +function returns
> > > +.Dv NULL
> > > +if the process is in "secure execution," otherwise it will call
> > > +.Fn getenv .
> > > +.Pp
> > > .Rv -std clearenv setenv putenv unsetenv
> > > .Sh ERRORS
> > > .Bl -tag -width Er
> > > diff --git a/lib/libc/stdlib/getenv.c b/lib/libc/stdlib/getenv.c
> > > index 7ca27ab710c4..86a846d58c69 100644
> > > --- a/lib/libc/stdlib/getenv.c
> > > +++ b/lib/libc/stdlib/getenv.c
> > > @@ -447,6 +447,18 @@ getenv(const char *name)
> > > }
> > >
> > >
> > > +/*
> > > + * Runs getenv() unless the current process is tainted by uid or gid
> changes, in
> > > + * which case it will return NULL.
> > > + */
> > > +char *
> > > +secure_getenv(const char *name)
> > > +{
> > > +     if (issetugid())
> > > +             return NULL;
> > > +     return getenv(name);
> >
> > return (...);
> >
> > (x2)
> >
> > style(9) says they are optional now so it's below my radar.... but
> honestly, it's good enough given the dozen other issues fixed in the pr.
>
> I still see "Values in return statements should be enclosed in
> parentheses."? Which isn=E2=80=99t an RFC SHOULD, much of style(9) is sho=
uld
> rather than must.
>

We need to do a pass to use rfc language. In this case,  thought it's been
encouraged but not required for a long time. I added the explicit language
years ago since it was only by example prior to that. I thought this was
one of the many lossenings we've had over the years, but if so there's been
no update since I added the should language... I know I've committed a lot
of new code without it over the years...

It may just have been a combo of many other projects forbidding the
practice and it was one of the variations my script found... I'll have to
go find the script to see.

But like I said before... git clang-format...

Warner

Jess
>
> > Though I'll see about adding git clang-format setup to check. I wrote a
> stupidly simple script to check 2 years ago and the commits coming in at
> the time had way more exceptions and variations than I thought I'd catch
> when I tested it out... but it could be turned into a gihub action easily
> enough I think.
> >
> > Warner
> >
> > Jess
> >
> > > +}
> > > +
> > > /*
> > >  * Set the value of a variable.  Older settings are labeled as
> inactive.  If an
> > >  * older setting has enough room to store the new value, it will be
> reused.  No
>
>

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

<div dir=3D"auto"><div><br><br><div class=3D"gmail_quote"><div dir=3D"ltr" =
class=3D"gmail_attr">On Mon, Mar 13, 2023, 10:45 PM Jessica Clarke &lt;<a h=
ref=3D"mailto:jrtc27@freebsd.org" target=3D"_blank" rel=3D"noreferrer">jrtc=
27@freebsd.org</a>&gt; wrote:<br></div><blockquote class=3D"gmail_quote" st=
yle=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">On 14=
 Mar 2023, at 04:37, Warner Losh &lt;<a href=3D"mailto:imp@bsdimp.com" rel=
=3D"noreferrer noreferrer" target=3D"_blank">imp@bsdimp.com</a>&gt; wrote:<=
br>
&gt; <br>
&gt; <br>
&gt; <br>
&gt; On Mon, Mar 13, 2023, 10:21 PM Jessica Clarke &lt;<a href=3D"mailto:jr=
tc27@freebsd.org" rel=3D"noreferrer noreferrer" target=3D"_blank">jrtc27@fr=
eebsd.org</a>&gt; wrote:<br>
&gt; On 14 Mar 2023, at 04:19, Warner Losh &lt;imp@FreeBSD.org&gt; wrote:<b=
r>
&gt; &gt; <br>
&gt; &gt; The branch main has been updated by imp:<br>
&gt; &gt; <br>
&gt; &gt; URL: <a href=3D"https://cgit.FreeBSD.org/src/commit/?id=3Dadeca21=
464d25bc61f98968a5c1e76ab3c808ae4" rel=3D"noreferrer noreferrer noreferrer"=
 target=3D"_blank">https://cgit.FreeBSD.org/src/commit/?id=3Dadeca21464d25b=
c61f98968a5c1e76ab3c808ae4</a><br>
&gt; &gt; <br>
&gt; &gt; commit adeca21464d25bc61f98968a5c1e76ab3c808ae4<br>
&gt; &gt; Author:=C2=A0 =C2=A0 =C2=A0lucy &lt;<a href=3D"mailto:seafork@dis=
root.org" rel=3D"noreferrer noreferrer" target=3D"_blank">seafork@disroot.o=
rg</a>&gt;<br>
&gt; &gt; AuthorDate: 2023-03-13 22:01:12 +0000<br>
&gt; &gt; Commit:=C2=A0 =C2=A0 =C2=A0Warner Losh &lt;imp@FreeBSD.org&gt;<br=
>
&gt; &gt; CommitDate: 2023-03-14 04:19:24 +0000<br>
&gt; &gt; <br>
&gt; &gt;=C2=A0 =C2=A0 Add GNU glibc compatible secure_getenv<br>
&gt; &gt; <br>
&gt; &gt;=C2=A0 =C2=A0 Add mostly glibc and msl compatible secure_getenv. R=
eturn NULL if<br>
&gt; &gt;=C2=A0 =C2=A0 issetugid() indicates the process is tainted, otherw=
ise getenv(x).=C2=A0 The<br>
&gt; &gt;=C2=A0 =C2=A0 rational behind this is the fact that many Linux app=
lications use this<br>
&gt; &gt;=C2=A0 =C2=A0 function instead of getenv() as it&#39;s widely cons=
ider a, &quot;best<br>
&gt; &gt;=C2=A0 =C2=A0 practice&quot;.<br>
&gt; &gt; <br>
&gt; &gt;=C2=A0 =C2=A0 Reviewed by: imp, mjg (feedback)<br>
&gt; &gt;=C2=A0 =C2=A0 Pull Request: <a href=3D"https://github.com/freebsd/=
freebsd-src/pull/686" rel=3D"noreferrer noreferrer noreferrer" target=3D"_b=
lank">https://github.com/freebsd/freebsd-src/pull/686</a><br>;
&gt; &gt;=C2=A0 =C2=A0 Signed-off-by: Lucy Marsh &lt;<a href=3D"mailto:seaf=
ork@disroot.org" rel=3D"noreferrer noreferrer" target=3D"_blank">seafork@di=
sroot.org</a>&gt;<br>
&gt; &gt; ---<br>
&gt; &gt; include/stdlib.h=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0|=
=C2=A0 1 +<br>
&gt; &gt; lib/libc/stdlib/Makefile.inc |=C2=A0 4 ++--<br>
&gt; &gt; lib/libc/stdlib/Symbol.map=C2=A0 =C2=A0|=C2=A0 1 +<br>
&gt; &gt; lib/libc/stdlib/getenv.3=C2=A0 =C2=A0 =C2=A0| 26 ++++++++++++++++=
+++++++++-<br>
&gt; &gt; lib/libc/stdlib/getenv.c=C2=A0 =C2=A0 =C2=A0| 12 ++++++++++++<br>
&gt; &gt; 5 files changed, 41 insertions(+), 3 deletions(-)<br>
&gt; &gt; <br>
&gt; &gt; diff --git a/include/stdlib.h b/include/stdlib.h<br>
&gt; &gt; index 01629ed84a11..c41e8704e810 100644<br>
&gt; &gt; --- a/include/stdlib.h<br>
&gt; &gt; +++ b/include/stdlib.h<br>
&gt; &gt; @@ -111,6 +111,7 @@ void=C2=A0 =C2=A0 =C2=A0 =C2=A0qsort(void *, =
size_t, size_t,<br>
&gt; &gt;=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0int (* _Nonnull)(const vo=
id *, const void *));<br>
&gt; &gt; int=C2=A0 =C2=A0 rand(void);<br>
&gt; &gt; void=C2=A0 *realloc(void *, size_t) __result_use_check __alloc_si=
ze(2);<br>
&gt; &gt; +char *secure_getenv(const char *);<br>
&gt; &gt; void=C2=A0 =C2=A0srand(unsigned);<br>
&gt; &gt; double=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0strtod(const char * __res=
trict, char ** __restrict);<br>
&gt; &gt; float=C2=A0 strtof(const char * __restrict, char ** __restrict);<=
br>
&gt; &gt; diff --git a/lib/libc/stdlib/Makefile.inc b/lib/libc/stdlib/Makef=
ile.inc<br>
&gt; &gt; index 8ace2c051b82..964e7ce30594 100644<br>
&gt; &gt; --- a/lib/libc/stdlib/Makefile.inc<br>
&gt; &gt; +++ b/lib/libc/stdlib/Makefile.inc<br>
&gt; &gt; @@ -46,8 +46,8 @@ MAN+=3D=C2=A0 =C2=A0 =C2=A0 =C2=A0a64l.3 abort.=
3 abs.3 alloca.3 atexit.3 atof.3 \<br>
&gt; &gt; MLINKS+=3Da64l.3 l64a.3 a64l.3 l64a_r.3<br>
&gt; &gt; MLINKS+=3Datol.3 atoll.3<br>
&gt; &gt; MLINKS+=3Dexit.3 _Exit.3<br>
&gt; &gt; -MLINKS+=3Dgetenv.3 clearenv.3 getenv.3 putenv.3 getenv.3 setenv.=
3 \<br>
&gt; &gt; -=C2=A0 =C2=A0 =C2=A0getenv.3 unsetenv.3<br>
&gt; &gt; +MLINKS+=3Dgetenv.3 clearenv.3 getenv.3 putenv.3 getenv.3 secure_=
getenv.3 \<br>
&gt; &gt; +=C2=A0 =C2=A0 =C2=A0getenv.3 setenv.3 getenv.3 unsetenv.3<br>
&gt; &gt; MLINKS+=3Dgetopt_long.3 getopt_long_only.3<br>
&gt; &gt; MLINKS+=3Dhcreate.3 hdestroy.3 hcreate.3 hsearch.3<br>
&gt; &gt; MLINKS+=3Dhcreate.3 hcreate_r.3 hcreate.3 hdestroy_r.3 hcreate.3 =
hsearch_r.3<br>
&gt; &gt; diff --git a/lib/libc/stdlib/Symbol.map b/lib/libc/stdlib/Symbol.=
map<br>
&gt; &gt; index 9d2944fdb7e9..a105f781734d 100644<br>
&gt; &gt; --- a/lib/libc/stdlib/Symbol.map<br>
&gt; &gt; +++ b/lib/libc/stdlib/Symbol.map<br>
&gt; &gt; @@ -128,6 +128,7 @@ FBSD_1.6 {<br>
&gt; &gt; FBSD_1.7 {<br>
&gt; &gt;=C2=A0 =C2=A0 =C2=A0 =C2=A0clearenv;<br>
&gt; &gt;=C2=A0 =C2=A0 =C2=A0 =C2=A0qsort_r;<br>
&gt; &gt; +=C2=A0 =C2=A0 =C2=A0secure_getenv;<br>
&gt; &gt; };<br>
&gt; &gt; <br>
&gt; &gt; FBSDprivate_1.0 {<br>
&gt; &gt; diff --git a/lib/libc/stdlib/getenv.3 b/lib/libc/stdlib/getenv.3<=
br>
&gt; &gt; index 5566d7b01dcd..93c0d2ada6ad 100644<br>
&gt; &gt; --- a/lib/libc/stdlib/getenv.3<br>
&gt; &gt; +++ b/lib/libc/stdlib/getenv.3<br>
&gt; &gt; @@ -32,13 +32,14 @@<br>
&gt; &gt; .\&quot;=C2=A0 =C2=A0 =C2=A0@(#)getenv.3=C2=A0 8.2 (Berkeley) 12/=
11/93<br>
&gt; &gt; .\&quot; $FreeBSD$<br>
&gt; &gt; .\&quot;<br>
&gt; &gt; -.Dd November 7, 2021<br>
&gt; &gt; +.Dd March 13, 2023<br>
&gt; &gt; .Dt GETENV 3<br>
&gt; &gt; .Os<br>
&gt; &gt; .Sh NAME<br>
&gt; &gt; .Nm clearenv ,<br>
&gt; &gt; .Nm getenv ,<br>
&gt; &gt; .Nm putenv ,<br>
&gt; &gt; +.Nm secure_getenv ,<br>
&gt; &gt; .Nm setenv ,<br>
&gt; &gt; .Nm unsetenv<br>
&gt; &gt; .Nd environment variable functions<br>
&gt; &gt; @@ -50,6 +51,8 @@<br>
&gt; &gt; .Fn clearenv &quot;void&quot;<br>
&gt; &gt; .Ft char *<br>
&gt; &gt; .Fn getenv &quot;const char *name&quot;<br>
&gt; &gt; +.Ft char *<br>
&gt; &gt; +.Fn secure_getenv &quot;const char *name&quot;<br>
&gt; &gt; .Ft int<br>
&gt; &gt; .Fn setenv &quot;const char *name&quot; &quot;const char *value&q=
uot; &quot;int overwrite&quot;<br>
&gt; &gt; .Ft int<br>
&gt; &gt; @@ -78,6 +81,20 @@ to by the<br>
&gt; &gt; .Fn getenv<br>
&gt; &gt; function.<br>
&gt; &gt; .Pp<br>
&gt; &gt; +The GNU-specific function,<br>
&gt; <br>
&gt; I don=E2=80=99t think it is now?..<br>
&gt; <br>
&gt; Yes...<br>
&gt; <br>
&gt; &gt; +.Fn secure_getenv<br>
&gt; &gt; +wraps the<br>
&gt; &gt; +.Fn getenv<br>
&gt; &gt; +function to prevent it from being run in &quot;secure execution&=
quot;.<br>
&gt; &gt; +Unlike in glibc,<br>
&gt; &gt; +.Fn secure_getenv<br>
&gt; &gt; +only checks if the<br>
&gt; &gt; +.Fa setuid<br>
&gt; &gt; +and<br>
&gt; &gt; +.Fa setgid<br>
&gt; &gt; +bits have been set or changed.<br>
&gt; &gt; +These checks are subject to extension and change.<br>
&gt; &gt; +.Pp<br>
&gt; &gt; The<br>
&gt; &gt; .Fn setenv<br>
&gt; &gt; function inserts or resets the environment variable<br>
&gt; &gt; @@ -139,6 +156,13 @@ is not in the current environment,<br>
&gt; &gt; .Dv NULL<br>
&gt; &gt; is returned.<br>
&gt; &gt; .Pp<br>
&gt; &gt; +The<br>
&gt; &gt; +.Fn secure_getenv<br>
&gt; &gt; +function returns<br>
&gt; &gt; +.Dv NULL<br>
&gt; &gt; +if the process is in &quot;secure execution,&quot; otherwise it =
will call<br>
&gt; &gt; +.Fn getenv .<br>
&gt; &gt; +.Pp<br>
&gt; &gt; .Rv -std clearenv setenv putenv unsetenv<br>
&gt; &gt; .Sh ERRORS<br>
&gt; &gt; .Bl -tag -width Er<br>
&gt; &gt; diff --git a/lib/libc/stdlib/getenv.c b/lib/libc/stdlib/getenv.c<=
br>
&gt; &gt; index 7ca27ab710c4..86a846d58c69 100644<br>
&gt; &gt; --- a/lib/libc/stdlib/getenv.c<br>
&gt; &gt; +++ b/lib/libc/stdlib/getenv.c<br>
&gt; &gt; @@ -447,6 +447,18 @@ getenv(const char *name)<br>
&gt; &gt; }<br>
&gt; &gt; <br>
&gt; &gt; <br>
&gt; &gt; +/*<br>
&gt; &gt; + * Runs getenv() unless the current process is tainted by uid or=
 gid changes, in<br>
&gt; &gt; + * which case it will return NULL.<br>
&gt; &gt; + */<br>
&gt; &gt; +char *<br>
&gt; &gt; +secure_getenv(const char *name)<br>
&gt; &gt; +{<br>
&gt; &gt; +=C2=A0 =C2=A0 =C2=A0if (issetugid())<br>
&gt; &gt; +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0return NULL;<br>
&gt; &gt; +=C2=A0 =C2=A0 =C2=A0return getenv(name);<br>
&gt; <br>
&gt; return (...);<br>
&gt; <br>
&gt; (x2)<br>
&gt; <br>
&gt; style(9) says they are optional now so it&#39;s below my radar.... but=
 honestly, it&#39;s good enough given the dozen other issues fixed in the p=
r.<br>
<br>
I still see &quot;Values in return statements should be enclosed in<br>
parentheses.&quot;? Which isn=E2=80=99t an RFC SHOULD, much of style(9) is =
should<br>
rather than must.<br></blockquote></div></div><div dir=3D"auto"><br></div><=
div dir=3D"auto">We need to do a pass to use rfc language. In this case,=C2=
=A0 thought it&#39;s been encouraged but not required for a long time. I ad=
ded the explicit language years ago since it was only by example prior to t=
hat. I thought this was one of the many lossenings we&#39;ve had over the y=
ears, but if so there&#39;s been no update since I added the should languag=
e... I know I&#39;ve committed a lot of new code without it over the years.=
..</div><div dir=3D"auto"><br></div><div dir=3D"auto">It may just have been=
 a combo of many other projects forbidding the practice and it was one of t=
he variations my script found... I&#39;ll have to go find the script to see=
.</div><div dir=3D"auto"><br></div><div dir=3D"auto">But like I said before=
... git clang-format...</div><div dir=3D"auto"><br></div><div dir=3D"auto">=
Warner</div><div dir=3D"auto"><br></div><div dir=3D"auto"><div class=3D"gma=
il_quote"><blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;bord=
er-left:1px #ccc solid;padding-left:1ex">
Jess<br>
<br>
&gt; Though I&#39;ll see about adding git clang-format setup to check. I wr=
ote a stupidly simple script to check 2 years ago and the commits coming in=
 at the time had way more exceptions and variations than I thought I&#39;d =
catch when I tested it out... but it could be turned into a gihub action ea=
sily enough I think.<br>
&gt; <br>
&gt; Warner <br>
&gt; <br>
&gt; Jess<br>
&gt; <br>
&gt; &gt; +}<br>
&gt; &gt; +<br>
&gt; &gt; /*<br>
&gt; &gt;=C2=A0 * Set the value of a variable.=C2=A0 Older settings are lab=
eled as inactive.=C2=A0 If an<br>
&gt; &gt;=C2=A0 * older setting has enough room to store the new value, it =
will be reused.=C2=A0 No<br>
<br>
</blockquote></div></div></div>

--000000000000dcc71305f6d52663--



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