Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 10 Sep 2023 07:58:37 -0500
From:      Mike Karels <mike@karels.net>
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>, 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:  <B5CFB43D-7D86-45C9-9C25-B31CAB749DC4@karels.net>
In-Reply-To: <96C2F8F3-D3F0-48FC-BEEC-E3C983BD680A@yahoo.com>
References:  <96C2F8F3-D3F0-48FC-BEEC-E3C983BD680A.ref@yahoo.com> <96C2F8F3-D3F0-48FC-BEEC-E3C983BD680A@yahoo.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On 10 Sep 2023, at 2:31, Mark Millard 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.

mkfile is broken.  getopt returns an int, and -1 on end.
It never returns 0xff.  But mkfile declares ch as char,
which truncates the return value -1.  ch is a bad (misleading)
variable name, although getopt(3) uses it as well (but declared
as int).

		Mike

> 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.
>
>
> ===
> Mark Millard
> marklmi at yahoo.com



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?B5CFB43D-7D86-45C9-9C25-B31CAB749DC4>