I had broken this in testlang_parse.y 1.22 from 2021-02-07, when I
extracted the common 'eol' from the statements. Extracting 'eol' had
the effect that the action for the statement was run before the line
number increased.
Now the line numbers in the diagnostics are the same again as before.
For lines that end with a backslash, the reported line number is the one
from the last of these lines, not the first one, also as before. This
feature is not used by any of the current tests though.
It looks as if the original author just didn't know how to declare the
type of non-terminals. The explicit types in the '$' expressions were
all consistent.
No functional change.
The libcurses framework is not strictly typed and thus provides plenty
of ways to shoot yourself in the foot. It's a waste of time debugging
things that a proper programming language can easily prevent.
The function addch expects an argument of type 'chtype'. Passing a
"double-quoted" string does not match this, as 'chtype' is completely
different from a plain 'char'. Instead, functions taking a 'chtype'
must be passed a `backtick-quoted` string.
Previously, there were several concurring styles:
$msg in line %zu of file %s
$msg line %zu of file %s
%s, %zu: $msg
All these are now replaced with "%s:%zu: $msg".
Previously, commas were completely ignored by the grammar. Erroring out
on invalid characters made some of the tests fail since the comma was
not recognized anymore. Add it back, but only for defining arrays. It
would have been possible to leave out the commas or make them optional,
but since the current tests do not make use of that, keep the grammar as
strict as possible.
Fix an unclosed string literal in a test. This had been wrongly
accepted before by the grammar.
Be strict when parsing the tests. Any unknown character is an error.
This avoids an endless loop when running "./director /dev/zero". There
is no point in silently ignoring other invalid characters as well, as
this would only leave potential test writers in an unclear state,
without any benefit.
The function getyx is not a function but a macro. It does not return
int, but void. Since these changes destroy the simplicity of the
example, combining a regular return value and pass-by-reference return
values, I rewrote the whole section and added more examples.
There is no need to write the keywords in upper case or mixed case. The
only case where a keyword did not have the canonical form yet was a
single lowercase 'ok' in the test case 'innstr'.
The test framework doesn't check the files strictly, it only checks
whether the expected output is a prefix of the actual output, or vice
versa. This allows several deviations to pass unnoticed, which is
wrong.
Up to now, the test command "compare /dev/null" was a no-op since the
command was only parsed but not run at all. Now run it.
This makes the test mvwin fail. That test will have to be fixed.
Comparing to /dev/null is certainly possible and may make sense,
comparing to /dev/zero is nonsense since the actual stream can never be
endless. Some tests do that nevertheless, for whatever reason.
In order to have the expected test output closer to the curses commands
that cause it, it may be a good idea to add another command
'compare_str' that would work independently of an external file and at
the same time allow the expected output to be commented and explained.
This is not possible right now since the .chk files are read exactly
as-is.
The grammar rule 'args' has been left as-is since it needs to be split
into 'args' and 'arg' first, to avoid the redundancy.
The braces in "if (create_check_file)" were misleading. It's strange that
GCC didn't reject this.
Previously, each statement ended with 'eol'. This was unnecessarily
verbose since the 'eol' is not really part of the statement, it's part
of a line.
No functional change.
This makes it possible to write small remarks directly in the affected
line, which not only makes for a clean visual appearance but also shows
up prominently in "cvs annotate" or "git blame", showing when such a
remark has been modified.
Several of the braces were misaligned. For the simple keywords, there
is no need to write these braces at all, they only made the code look
more complicated than it really is.
I stumbled upon this because syntax errors in the test cases currently
let the test case succeed instead of fail, which is another ingredient
for unreliable tests, besides the loose output matching.
When adding "\t" via addch, win.curx advances by twice the spaces as
intended. This bug was introduced somewhere between NetBSD 8.0 and 9.0.
Adding "\t" via addstr does not have this bug.
This bug causes the installation menu of sysinst to be have its menu
items indented by 16 characters instead of only 8. This in turn
produces an ugly line break in the German translation.
The test framework for libcurses is not well integrated into ATF.
Whenever the expected output is longer than the actual output, or vice
versa, the test passes nevertheless. This makes it necessary to
constantly look into atf-run.log to see whether the actual output is
indeed equal to the expected output, which is crucial, especially for
telling the difference between addstr and addnstr.
Reusing the .chk files for several tests is not a good idea either. For
example, addstr and waddstr are supposed to produce the same result for
ASCII-only text, so it was tempting to use the same file. But waddstr
seems to have a bug (maybe undefined behavior), at least waddstr returns
ERR in one case where it shouldn't. This means that currently the
expected output (acknowledging the bug) must be different.
The "expected" test output in waddstr.chk looks completely broken, but
that's exactly what the test produces right now.
It's GXemul that has the bug! Unfortunately, there's no way (currently) to
detect if we're running under GXemul emulation, so disable for all mips
for now. Hopefully, GXemul will get fixed soon.
since there are already tests for audio this is focused on making
sure the ioctls translate properly and implement the necessary OSS
compat quirks.
right now this only covers the dsp ioctls, it should also cover the
mixer ioctls, although that's significantly harder.
sure we own the guard page before we set its protection to none. This fixes
random SEGVs where the page we set protection to none probably belonged to
the dynamic linker. Reported by gson@
When calling FXSAVE, XSAVE, FXRSTOR, ... for 64-bit programs on amd64
use the 64-suffixed variant in order to include the complete FIP/FDP
registers in the x87 area.
The difference between the two variants is that the FXSAVE64 (new)
variant represents FIP/FDP as 64-bit fields (union fp_addr.fa_64),
while the legacy FXSAVE variant uses split fields: 32-bit offset,
16-bit segment and 16-bit reserved field (union fp_addr.fa_32).
The latter implies that the actual addresses are truncated to 32 bits
which is insufficient in modern programs.
The change is applied only to 64-bit programs on amd64. Plain i386
and compat32 continue using plain FXSAVE. Similarly, NVMM is not
changed as I am not familiar with that code.
This is a potentially breaking change. However, I don't think it likely
to actually break anything because the data provided by the old variant
were not meaningful (because of the truncated pointer).
http://cvsweb.netbsd.org/bsdweb.cgi/src/tests/lib/libc/sys/t_ptrace_core_wait.h#rev1.2
> For powerpc, program counter is not automatically incremented by trap
> instruction. We cannot increment PC in the trap handler, which breaks
> applications depending on this behavior, e.g., GDB.
This statement is true for aarch64 and arm.
Also, use PTRACE_BREAKPOINT_SIZE instead of hard-coded 4 to address
instruction next to PC.
OK ryo
Fix the code reconstructing s87_tw (full tag word) from fx_sw (abridged
tag word) to correctly represent all register states. The previous code
only distinguished between empty/non-empty registers, and assigned
'regular value' to all non-empty registers. The new code explicitly
distinguishes the two other tag word values: empty and special.
Rename the MM_REG macro to ST_MAN, to make it clearer that it gets
mantissa of ST registers which overlaps with MM registers but can be
also used to read ST registers (to be used in the next commit). Extend
it to cover the difference between GETFPREGS and GETXSTATE,
and therefore avoid additional condition on i386.
Reviewed by kamil.
right now. new address-of-packed-member and format-overflow
warnings have new GCC_NO_ADDR_OF_PACKED_MEMBER amd
GCC_NO_FORMAT_OVERFLOW variables to remove these warnings.
apply to a bunch of the tree. mostly, these are real bugs that
should be fixed, but in many cases, only by removing the 'packed'
attribute from some structure that doesn't really need it. (i
looked at many different ones, and while perhaps 60-80% were
already properly aligned, it wasn't clear to me that the uses
were always coming from sane data vs network alignment, so it
doesn't seem safe to remove packed without careful research for
each affect struct.) clang already warned (and was not erroring)
for many of these cases, but gcc picked up dozens more.
Use sigaction() without SA_RESTART -- signal() implies SA_RESTART so
we never got the EINTR.
While here, reduce the timeout to something more reasonable so we
don't waste 20min of testbed time if anything goes wrong and the
one-second alarm doesn't fire.
Three ways to call:
getrandom(p, n, 0) Blocks at boot until full entropy.
Returns up to n bytes at p; guarantees
up to 256 bytes even if interrupted
after blocking. getrandom(0,0,0)
serves as an entropy barrier: return
only after system has full entropy.
getrandom(p, n, GRND_INSECURE) Never blocks. Guarantees up to 256
bytes even if interrupted. Equivalent
to /dev/urandom. Safe only after
successful getrandom(...,0),
getrandom(...,GRND_RANDOM), or read
from /dev/random.
getrandom(p, n, GRND_RANDOM) May block at any time. Returns up to n
bytes at p, but no guarantees about how
many -- may return as short as 1 byte.
Equivalent to /dev/random. Legacy.
Provided only for source compatibility
with Linux.
Can also use flags|GRND_NONBLOCK to fail with EWOULDBLOCK/EAGAIN
without producing any output instead of blocking.
- The combination GRND_INSECURE|GRND_NONBLOCK is the same as
GRND_INSECURE, since GRND_INSECURE never blocks anyway.
- The combinations GRND_INSECURE|GRND_RANDOM and
GRND_INSECURE|GRND_RANDOM|GRND_NONBLOCK are nonsensical and fail
with EINVAL.
As proposed on tech-userlevel, tech-crypto, tech-security, and
tech-kern, and subsequently adopted by core (minus the getentropy part
of the proposal, because other operating systems and participants in
the discussion couldn't come to an agreement about getentropy and
blocking semantics):
https://mail-index.netbsd.org/tech-userlevel/2020/05/02/msg012333.html
In a private email, Miloslav had agreed that if they had written the
test, then it can be licensed bsd-2-clause. I am going to assume this
is true as the file names Miloslav as the author.
This test was likely sent to tcsh (not netbsd) that had changed bug
report systems since.