Date: Sun, 22 Sep 2024 17:52:43 +0100 From: Warner Losh <imp@bsdimp.com> To: Konstantin Belousov <kostikbel@gmail.com> Cc: Warner Losh <imp@freebsd.org>, src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Subject: Re: git: 07d90ee0a621 - main - kvprintf(): Fix '+' conversion handling Message-ID: <CANCZdfo2W0OtDXkMv1EAFGxqoPqSgPXutvHegRGspE3k5W2opQ@mail.gmail.com> In-Reply-To: <Ztt4XCQtc_MFcM4m@kib.kiev.ua> References: <202409061835.486IZ9Fd010541@gitrepo.freebsd.org> <Zttr1UzRKtHz_6o5@kib.kiev.ua> <CANCZdfrrQ0eeHPU9qJdvin-daXphHBbExUiuLe0Wq1t_R0rtPg@mail.gmail.com> <Ztt4XCQtc_MFcM4m@kib.kiev.ua>
next in thread | previous in thread | raw e-mail | index | archive | help
--00000000000086f8c80622b81a5b Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Fri, Sep 6, 2024 at 10:47=E2=80=AFPM Konstantin Belousov <kostikbel@gmai= l.com> wrote: > On Fri, Sep 06, 2024 at 03:14:49PM -0600, Warner Losh wrote: > > On Fri, Sep 6, 2024 at 2:53=E2=80=AFPM Konstantin Belousov <kostikbel@g= mail.com> > > wrote: > > > > > On Fri, Sep 06, 2024 at 06:35:09PM +0000, Warner Losh wrote: > > > > The branch main has been updated by imp: > > > > > > > > URL: > > > > https://cgit.FreeBSD.org/src/commit/?id=3D07d90ee0a62110e5161bb0b8a3a0b1b= 9d2beabad > > > > > > > > commit 07d90ee0a62110e5161bb0b8a3a0b1b9d2beabad > > > > Author: Sebastian Huber <sebastian.huber@embedded-brains.de> > > > > AuthorDate: 2024-06-14 07:30:28 +0000 > > > > Commit: Warner Losh <imp@FreeBSD.org> > > > > CommitDate: 2024-09-06 18:34:30 +0000 > > > > > > > > kvprintf(): Fix '+' conversion handling > > > > > > > > For example, printf("%+i", 1) prints "+1". However, kvprintf() > did > > > > print just "1" for this example. According to PRINTF(3): > > > > > > > > A sign must always be placed before a number produced by a > signed > > > > conversion. > > > > > > > > For "%+r" radix conversions, keep the "+" handling as it is, > since > > > this > > > > is a non-standard conversion. For "%+p" pointer conversions, > > > continue > > > > to ignore the sign modifier to be in line with libc. > > > > > > > > This change allows to support the ' conversion modifier in the > > > future. > > > > > > > > Reviewed by: imp > > > > Pull Request: https://github.com/freebsd/freebsd-src/pull/1310 > > > > --- > > > > sys/kern/subr_prf.c | 27 +++++++++++++-------------- > > > > 1 file changed, 13 insertions(+), 14 deletions(-) > > > Again, isn't rtld_printf needs the same change? > > > > > > > This time I don't think so. I'll double check though. I'd checked when > this > > came in. Thanks for the reminder. > It would be weird if not needed, rtld_printf.c was a copy of subr_prf.c. > Yes. It's required. I've updated and committed. Thanks again for the reminder. I must have been confused when I thought it wasn't needed, since it isn't even a close call looking at it just now. Warner --00000000000086f8c80622b81a5b 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 Fri, Sep 6, 2024 at 10:47=E2=80=AF= PM Konstantin Belousov <<a href=3D"mailto:kostikbel@gmail.com">kostikbel= @gmail.com</a>> wrote:<br></div><blockquote class=3D"gmail_quote" style= =3D"margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding= -left:1ex">On Fri, Sep 06, 2024 at 03:14:49PM -0600, Warner Losh wrote:<br> > On Fri, Sep 6, 2024 at 2:53=E2=80=AFPM Konstantin Belousov <<a href= =3D"mailto:kostikbel@gmail.com" target=3D"_blank">kostikbel@gmail.com</a>&g= t;<br> > wrote:<br> > <br> > > On Fri, Sep 06, 2024 at 06:35:09PM +0000, Warner Losh wrote:<br> > > > The branch main has been updated by imp:<br> > > ><br> > > > URL:<br> > > <a href=3D"https://cgit.FreeBSD.org/src/commit/?id=3D07d90ee0a621= 10e5161bb0b8a3a0b1b9d2beabad" rel=3D"noreferrer" target=3D"_blank">https://= cgit.FreeBSD.org/src/commit/?id=3D07d90ee0a62110e5161bb0b8a3a0b1b9d2beabad<= /a><br> > > ><br> > > > commit 07d90ee0a62110e5161bb0b8a3a0b1b9d2beabad<br> > > > Author:=C2=A0 =C2=A0 =C2=A0Sebastian Huber <<a href=3D"ma= ilto:sebastian.huber@embedded-brains.de" target=3D"_blank">sebastian.huber@= embedded-brains.de</a>><br> > > > AuthorDate: 2024-06-14 07:30:28 +0000<br> > > > Commit:=C2=A0 =C2=A0 =C2=A0Warner Losh <imp@FreeBSD.org&g= t;<br> > > > CommitDate: 2024-09-06 18:34:30 +0000<br> > > ><br> > > >=C2=A0 =C2=A0 =C2=A0kvprintf(): Fix '+' conversion ha= ndling<br> > > ><br> > > >=C2=A0 =C2=A0 =C2=A0For example, printf("%+i", 1) p= rints "+1".=C2=A0 However, kvprintf() did<br> > > >=C2=A0 =C2=A0 =C2=A0print just "1" for this example= .=C2=A0 According to PRINTF(3):<br> > > ><br> > > >=C2=A0 =C2=A0 =C2=A0 =C2=A0A sign must always be placed befor= e a number produced by a signed<br> > > >=C2=A0 =C2=A0 =C2=A0 =C2=A0conversion.<br> > > ><br> > > >=C2=A0 =C2=A0 =C2=A0For "%+r" radix conversions, ke= ep the "+" handling as it is, since<br> > > this<br> > > >=C2=A0 =C2=A0 =C2=A0is a non-standard conversion.=C2=A0 For &= quot;%+p" pointer conversions,<br> > > continue<br> > > >=C2=A0 =C2=A0 =C2=A0to ignore the sign modifier to be in line= with libc.<br> > > ><br> > > >=C2=A0 =C2=A0 =C2=A0This change allows to support the ' c= onversion modifier in the<br> > > future.<br> > > ><br> > > >=C2=A0 =C2=A0 =C2=A0Reviewed by: imp<br> > > >=C2=A0 =C2=A0 =C2=A0Pull Request: <a href=3D"https://github.c= om/freebsd/freebsd-src/pull/1310" rel=3D"noreferrer" target=3D"_blank">http= s://github.com/freebsd/freebsd-src/pull/1310</a><br> > > > ---<br> > > >=C2=A0 sys/kern/subr_prf.c | 27 +++++++++++++--------------<b= r> > > >=C2=A0 1 file changed, 13 insertions(+), 14 deletions(-)<br> > > Again, isn't rtld_printf needs the same change?<br> > ><br> > <br> > This time I don't think so. I'll double check though. I'd = checked when this<br> > came in. Thanks for the reminder.<br> It would be weird if not needed, rtld_printf.c was a copy of subr_prf.c.<br= ></blockquote><div><br></div><div>Yes. It's required. I've updated = and committed. Thanks again for the reminder.</div><div>I must have been co= nfused when I thought it wasn't needed, since it isn't even</div><d= iv>a close call looking at it just now.</div><div><br></div><div>Warner=C2= =A0</div></div></div> --00000000000086f8c80622b81a5b--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CANCZdfo2W0OtDXkMv1EAFGxqoPqSgPXutvHegRGspE3k5W2opQ>