Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 10 Sep 2023 12:21:16 -0600
From:      Warner Losh <imp@bsdimp.com>
To:        Mark Millard <marklmi@yahoo.com>
Cc:        Martin Matuska <mm@freebsd.org>, Alexander Motin <mav@freebsd.org>,  Pawel Jakub Dawidek <pjd@freebsd.org>, Glen Barber <gjb@freebsd.org>, Mike Karels <mike@karels.net>,  Current FreeBSD <freebsd-current@freebsd.org>,  FreeBSD-STABLE Mailing List <freebsd-stable@freebsd.org>, freebsd-arm <freebsd-arm@freebsd.org>
Subject:   Re: Looks like the kyua zfs tests likely are not used on aarch64 or other contexts with unsigned char
Message-ID:  <CANCZdfo5YwOdR7d0DNkf_VJ-wq4R=OVN=zafecShFLoA58qYJQ@mail.gmail.com>
In-Reply-To: <DF839928-F06A-4F0A-8C3B-CAC97060D1CB@yahoo.com>
References:  <96C2F8F3-D3F0-48FC-BEEC-E3C983BD680A@yahoo.com> <DF839928-F06A-4F0A-8C3B-CAC97060D1CB@yahoo.com>

next in thread | previous in thread | raw e-mail | index | archive | help
--0000000000003b54c306050547d8
Content-Type: text/plain; charset="UTF-8"

On Sun, Sep 10, 2023, 11:10 AM Mark Millard <marklmi@yahoo.com> wrote:

> On Sep 10, 2023, at 00:31, Mark Millard <marklmi@yahoo.com> wrote:
>
> > kyua tests that use the:
> >
> > /usr/tests/sys/cddl/zfs/bin/mkfile
> >
> > program like so (for example):
> >
> > mkfile 500M /testpool.1861/bigfile.0
> >
> > (which should be valid) end up with mkfile
> > instead reporting:
> >
> > Standard error:
> > Usage: mkfile [-nv] <size>[e|p|t|g|m|k|b] <filename> ...
> >
> > which prevent the kyua test involved from working.
> >
> > Turns out this is from expecting char to be always
> > signed (so a -1 vs. 255 distinction, here in an
> > aarch64 context):
> >
> > . . .
> > (gdb) list
> > 179 /* Options. */
> > 180 while ((ch = getopt(argc, argv, "nv")) != -1) {
> > 181 switch (ch) {
> > 182 case 'n':
> > 183 nofill = 1;
> > 184 break;
> > 185 case 'v':
> > (gdb) print ch
> > $16 = 255 '\377'
> > (gdb) print/x -1
> > $17 = 0xffffffff
> > (gdb) print/x ch
> > $18 = 0xff
> > . . .
> >
> > With the mix of unsigned and signed it ends up
> > being a 0xffu != 0xffffffffu test, which is
> > always true.
> >
> > So the switch is reached as if a "-" prefix was
> > present (that is not). Then the "option" is classified
> > as invalid and the usage message is produced.
> >
> > Apparently no one had noticed. That, in turn, suggests a
> > lack of inspected testing on aarch64, powerpc64,
> > powerpc64le, armv7, powerpc, and powerpcspe. That, in
> > turn, suggests that kyua test inspection for the likes
> > of aarch64 is not historically a part of the release
> > process for openzfs or for operating systems that include
> > openzfs.
> >
>
> Looks like the mkfile.c traces back to a former port
> sysutils/mkfile that was unfetchable as of 2019. And,
> looking around, it seems the kyua zfs tests may be a
> FreeBSD only thing, not adopted in openzfs.
>
> So various implicit assumptions when I wrote the note
> do not actually hold.
>
> FreeBSD would have to do additional testing via kyua,
> beyond what openzfs does for testing, to discover the
> unsigned char related mis-behavior in the mkfile that
> FreeBSD's kyua tests use. Only FreeBSD variants are
> likely to have a similar status, not general openzfs
> including operating systems.
>

I wonder how hard ot would be to look for the char = getopt() pattern with
coccinelle

Warner

===
> Mark Millard
> marklmi at yahoo.com
>
>
>

--0000000000003b54c306050547d8
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 Sun, Sep 10, 2023, 11:10 AM Mark Millard &lt;<a hre=
f=3D"mailto:marklmi@yahoo.com">marklmi@yahoo.com</a>&gt; wrote:<br></div><b=
lockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1px =
#ccc solid;padding-left:1ex">On Sep 10, 2023, at 00:31, Mark Millard &lt;<a=
 href=3D"mailto:marklmi@yahoo.com" target=3D"_blank" rel=3D"noreferrer">mar=
klmi@yahoo.com</a>&gt; wrote:<br>
<br>
&gt; kyua tests that use the:<br>
&gt; <br>
&gt; /usr/tests/sys/cddl/zfs/bin/mkfile<br>
&gt; <br>
&gt; program like so (for example):<br>
&gt; <br>
&gt; mkfile 500M /testpool.1861/bigfile.0<br>
&gt; <br>
&gt; (which should be valid) end up with mkfile<br>
&gt; instead reporting:<br>
&gt; <br>
&gt; Standard error:<br>
&gt; Usage: mkfile [-nv] &lt;size&gt;[e|p|t|g|m|k|b] &lt;filename&gt; ...<b=
r>
&gt; <br>
&gt; which prevent the kyua test involved from working.<br>
&gt; <br>
&gt; Turns out this is from expecting char to be always<br>
&gt; signed (so a -1 vs. 255 distinction, here in an<br>
&gt; aarch64 context):<br>
&gt; <br>
&gt; . . .<br>
&gt; (gdb) list<br>
&gt; 179 /* Options. */<br>
&gt; 180 while ((ch =3D getopt(argc, argv, &quot;nv&quot;)) !=3D -1) {<br>
&gt; 181 switch (ch) {<br>
&gt; 182 case &#39;n&#39;:<br>
&gt; 183 nofill =3D 1;<br>
&gt; 184 break;<br>
&gt; 185 case &#39;v&#39;:<br>
&gt; (gdb) print ch<br>
&gt; $16 =3D 255 &#39;\377&#39;<br>
&gt; (gdb) print/x -1<br>
&gt; $17 =3D 0xffffffff<br>
&gt; (gdb) print/x ch<br>
&gt; $18 =3D 0xff<br>
&gt; . . .<br>
&gt; <br>
&gt; With the mix of unsigned and signed it ends up<br>
&gt; being a 0xffu !=3D 0xffffffffu test, which is<br>
&gt; always true.<br>
&gt; <br>
&gt; So the switch is reached as if a &quot;-&quot; prefix was<br>
&gt; present (that is not). Then the &quot;option&quot; is classified<br>
&gt; as invalid and the usage message is produced.<br>
&gt; <br>
&gt; Apparently no one had noticed. That, in turn, suggests a<br>
&gt; lack of inspected testing on aarch64, powerpc64,<br>
&gt; powerpc64le, armv7, powerpc, and powerpcspe. That, in<br>
&gt; turn, suggests that kyua test inspection for the likes<br>
&gt; of aarch64 is not historically a part of the release<br>
&gt; process for openzfs or for operating systems that include<br>
&gt; openzfs.<br>
&gt; <br>
<br>
Looks like the mkfile.c traces back to a former port<br>
sysutils/mkfile that was unfetchable as of 2019. And,<br>
looking around, it seems the kyua zfs tests may be a<br>
FreeBSD only thing, not adopted in openzfs.<br>
<br>
So various implicit assumptions when I wrote the note<br>
do not actually hold.<br>
<br>
FreeBSD would have to do additional testing via kyua,<br>
beyond what openzfs does for testing, to discover the<br>
unsigned char related mis-behavior in the mkfile that<br>
FreeBSD&#39;s kyua tests use. Only FreeBSD variants are<br>
likely to have a similar status, not general openzfs<br>
including operating systems.<br></blockquote></div></div><div dir=3D"auto">=
<br></div><div dir=3D"auto">I wonder how hard ot would be to look for the c=
har =3D getopt() pattern with coccinelle</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"gmail_quote"><blockquote class=3D"gmail_quote" style=3D"margi=
n:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
=3D=3D=3D<br>
Mark Millard<br>
marklmi at <a href=3D"http://yahoo.com" rel=3D"noreferrer noreferrer" targe=
t=3D"_blank">yahoo.com</a><br>
<br>
<br>
</blockquote></div></div></div>

--0000000000003b54c306050547d8--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CANCZdfo5YwOdR7d0DNkf_VJ-wq4R=OVN=zafecShFLoA58qYJQ>