| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
| |
Sponsored by: Klara, Inc.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The current incarnation of execvPe() is a bit messy, and it can be
rather difficult to reason about whether we're actually doing the right
thing with our errors. We have two cases in which we may enter the loop:
1.) We have a name that has no slashes in it, and we enter the loop
normally through our strsep() logic to process $PATH
2.) We have a name with at least one slash, in which case we jump into
the middle of the loop then bail after precisely the one iteration
if we failed
Both paths will exit the loop if we failed, either via jumping to the
`done` label to preserve an errno or into the path that clobbers errno.
Clobbering errno for case #2 above would seem to be wrong, as we did not
actually search -- this would seem to be what POSIX expects, as well,
based on expectations of the conformance test suite.
Simplify reasoning about the two paths by splitting out an execvPe_prog
that does the execve(2) call specifically, and returns based on whether
the error would be fatal in a PATH search or not. For the
relative/absolute case, we can just ignore the return value and keep
errno intact. The search case gets simplified to return early if
we hit a fatal error, or continue until the end and clobber errno if
we did not find a suitable candidate.
Another posix_spawnp() test is added to confirm that we didn't break our
EACCES behavior in the process.
Reviewed by: des, markj
Sponsored by: Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D51629
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
POSIX.1 states that `dbm_nextkey` must return an invalid key
(i.e., `key.dptr == NULL`) after the end of the database was reached.
The current implementation of `hash_seq` will incorrectly restart
the key sequence after the end of the database is reached.
Fix this by checking the "current bucket" index when R_NEXT is passed.
Sponsored by: Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D51635
Reviewed by: markj
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The dbm(3) manpage explicitly states that O_WRONLY is not allowed in
dbm_open, but a more recent comment in ` __hash_open` suggests otherwise.
Furthermore, POSIX.1 allows O_WRONLY in dbm_open and states
that the underlying file must be opened for both reading and writing.
Fix this by correcting the O_WRONLY check and moving it further into
the function to make sure that the original flags are stored in hashp.
Sponsored by: Klara, Inc.
Reviewed by: markj
Differential Revision: https://reviews.freebsd.org/D51514
|
|
|
|
|
|
| |
Sponsored by: Klara, Inc.
Reviewed by: markj
Differential Revision: https://reviews.freebsd.org/D51492
|
|
|
|
|
|
|
|
|
| |
While here, clean the detection code up a bit.
Sponsored by: Klara, Inc.
Sponsored by: NetApp, Inc.
Reviewed by: markj
Differential Revision: https://reviews.freebsd.org/D51343
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
On PowerPC platforms a valid link to the Table of Contents (TOC) is
required for PLT lookups to function. This TOC pointer is stored in
a dedicated register, and is used along with the stack pointer by both
C prologue and PLT lookup code.
When calling swapcontext() with uc_link != NULL, a PLT lookup to
setcontext(3) is attempted from within the _ctx_done context. The
exiting process has usually trashed both r1 and r2 at this point,
leading to a crash within the PLT lookup before setcontext(2) is
reached to restore the linked context.
Save and restore r2 as in a regular function. This ensures the
subsequent PLT lookup to setcontext(3) succeeds.
Signed-off-by: Timothy Pearson <tpearson@raptorengineering.com>
MFC after: 1 week
Pull Request: https://github.com/freebsd/freebsd-src/pull/1759
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Now that dd_size is unsigned, we need to check if the return value from
getdirentries() was negative before assigning it to dd_size.
While here, simplify the scandir_error test case slightly, and verify
that calling readdir() again after EOF still returns NULL.
Fixes: 42e613018da5
Sponsored by: Klara, Inc.
Reviewed by: kevans
Differential Revision: https://reviews.freebsd.org/D51266
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
If the calling process has used SIG_IGN as handler or set the
SA_NOCLDWAIT flag for SIGCHLD, processes will be automatically reaped on
exit and calls to waitpid(3) will therefore fail with ECHILD.
We waitpid primarily to reap our child so that the caller does not have
to worry about it. ECHILD indicates that there is no child to reap, so
we can just treat that as a success and move on.
Signed-off-by: Kenny Levinsen <kl@kl.wtf>
Tested by: Jan Beich
Pull Request: https://github.com/freebsd/freebsd-src/pull/1675
|
|
|
|
|
|
|
|
|
|
|
|
| |
* Add test cases for opendir() and fdopendir().
* Drop O_NONBLOCK from opendir(); it was added a long time ago to avoid
blocking if given a closed named pipe, but now we use O_DIRECTORY,
which ensures that we get ENOTDIR in that case.
* While here, remove unused #includes left over from the split.
Sponsored by: Klara, Inc.
Reviewed by: kevans, markj
Differential Revision: https://reviews.freebsd.org/D51126
|
|
|
|
|
|
| |
Sponsored by: Klara, Inc.
Reviewed by: kevans
Differential Revision: https://reviews.freebsd.org/D51098
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Currently, if `readdir()` fails, `scandir()` simply returns a partial
result (or a null result if it fails before any entries were selected).
There is no way within the current API design to return both a partial
result and an error indicator, so err on the side of caution: if an
error occurs, discard any partial result and return the error instead.
MFC after: 1 week
Reported by: Maxim Suhanov <dfirblog@gmail.com>
Sponsored by: Klara, Inc.
Reviewed by: markj
Differential Revision: https://reviews.freebsd.org/D51046
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This seems to fit the pattern better (e.g. fdopendir()).
I've added weak references to ease the transition, but since it's only
been a few days, we can remove them (and the ObsoleteFiles entries for
the manual pages) before we branch stable/15.
Fixes: deeebfdecab5
Sponsored by: Klara, Inc.
Reviewed by: kevans
Differential Revision: https://reviews.freebsd.org/D50980
|
|
|
|
|
|
|
|
|
|
|
| |
Most importantly, they need to run without privileges, since root is
allowed to read a directory regardless of its permission bits.
PR: 287694
Fixes: 4d7c31bca252
Sponsored by: Klara, Inc.
Reviewed by: bnovkov
Differential Revision: https://reviews.freebsd.org/D50965
|
|
|
|
|
|
|
|
|
|
|
|
| |
In the previous commit, I removed the initial initialization of the
`names` array, not realizing that `scandir()` is expected to return
a non-null (but empty) array of entries if no entries matched.
Restore the historical behavior, document it, and add a test.
Fixes: deeebfdecab5
Sponsored by: Klara, Inc.
Reviewed by: kevans, allanjude, markj
Differential Revision: https://reviews.freebsd.org/D50949
|
|
|
|
|
|
|
|
|
| |
While here, clean up scandir() a bit and improve the documentation.
MFC after: never
Sponsored by: Klara, Inc.
Reviewed by: markj
Differential Revision: https://reviews.freebsd.org/D50935
|
|
|
|
|
|
|
|
| |
sig2str(3)
Reviewed by: imp, kib, des, jilles
Pull Request: https://github.com/freebsd/freebsd-src/pull/1696
Closes: https://github.com/freebsd/freebsd-src/pull/1696
|
|
|
|
|
| |
Reviewed by: imp, kib, des, jilles
Pull Request: https://github.com/freebsd/freebsd-src/pull/1696
|
|
|
|
|
|
|
|
|
| |
This change adds tests that check basic callback functionality for
blocks and function pointers. The tests also make sure that GLOB_ERR
overrides the callback's return value.
Sponsored by: Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D50486
|
|
|
|
|
|
| |
This change was unreviewed and should not have been committed to :main.
This reverts commit 9b37d84c87e69dabc69d818aa4d2fea718bd8b74.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
These tests were recently enabled on main and have failed consistently
since they were enabled.
- lib.libc.net.getaddrinfo.getaddrinfo.basic
- lib.libc.net.getaddrinfo.getaddrinfo.nofamily
- lib.libc.net.getaddrinfo.getaddrinfo_test.basic
- lib.libc.net.getaddrinfo.getaddrinfo_test.empty_servname
- lib.libc.net.getaddrinfo.getaddrinfo_test.sock_raw
Mark them as expected failures so they no longer count as failures in
Jenkins CI.
PR: 285826
MFC with: 5313457780, 0b773a94ab
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
instead of accepting any character as a delimiter, only accept ':', '.'
and '-', and only permit a single delimiter in an address.
this prevents accepting bizarre addresses like:
ifconfig epair2a link 10.1.2.200/28
... which is particularly problematic on an INET6-only system, in which
case ifconfig defaults to the 'link' family, meaning that:
ifconfig epair2a 10.1.2.200/28
... changes the Ethernet address of the interface.
bump __FreeBSD_version so link_addr() consumers can detect the change.
Reviewed by: kp, des
Approved by: des (mentor)
Differential Revision: https://reviews.freebsd.org/D49936
|
|
|
|
| |
Sponsored by: Klara, Inc.
|
|
|
|
|
|
| |
Sponsored by: Klara, Inc.
Reviewed by: kevans, imp
Differential Revision: https://reviews.freebsd.org/D50235
|
|
|
|
|
|
| |
Sponsored by: Klara, Inc.
Reviewed by: kevans, imp
Differential Revision: https://reviews.freebsd.org/D50234
|
|
|
|
|
|
|
|
|
|
|
|
| |
this is a re-entrant version of link_ntoa. use an in-out parameter for
the buffer size, so the user requires at most two calls to determine the
needed size.
reimplement link_ntoa using link_ntoa_r with a static buffer.
Reviewed by: des
Approved by: des (mentor)
Differential Revision: https://reviews.freebsd.org/D50202
|
|
|
|
|
|
|
|
|
|
|
| |
<cstddef> is the correct header; this fixes the GCC build.
while here, sort the headers.
Fixes: 757e973fb211 ("libc tests: add tests for link_addr(3) and link_ntoa(3)")
Reviewed by: des
Approved by: des (mentor)
Differential Revision: https://reviews.freebsd.org/D50189
|
|
|
|
|
|
| |
Fixes: 873420ca1e6e ("libc: Add getenv_r() function.")
Reviewed by: des
Differential Revision: https://reviews.freebsd.org/D50172
|
|
|
|
|
|
|
|
|
| |
for now, since link_addr() has no way to indicate an error, these are
only positive tests which check the outcome of valid inputs.
Reviewed by: ngie, des, adrian
Approved by: des (mentor)
Differential Revision: https://reviews.freebsd.org/D50062
|
|
|
|
|
|
|
|
|
|
| |
This is a calque of the NetBSD function of the same name.
MFC after: never
Relontes: yes
Sponsored by: Klara, Inc.
Reviewed by: kevans
Differential Revision: https://reviews.freebsd.org/D49979
|
|
|
|
|
|
| |
Sponsored by: Klara, Inc.
Reviewed by: jrtc27
Differential Revision: https://reviews.freebsd.org/D49963
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This adds an `fts_open_b()` variant of `fts_open()` which takes a block
instead of a function pointer.
This was inspired by, and is intended to be compatible with, Apple's
implementation; however, although our FTS and theirs share a common
ancestor, they have diverged significantly. That and the fact that
we still target compilers which don't support blocks means Apple's
implementation was not directly reusable.
This is the second use case for blocks in FreeBSD (the first being
`qsort_b()`, which we use here). This suggest we might want to add
a `COMPILER_FEATURE` for blocks to avoid hardcoding any further
`COMPILER_TYPE` checks.
MFC after: never
Relnotes: yes
Sponsored by: Klara, Inc.
Reviewed by: kevans, theraven, imp
Differential Revision: https://reviews.freebsd.org/D49877
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
wchar_t is unsigned on ARM platforms, and signed pretty much everywhere
else. On signed platforms, `nm` ends up with bogus upper bits set if we
did in-fact have a valid CS2 or CS3 (MSB set). Mask just the low byte
to avoid sign bit garbage.
Bare basic test of converting a CS2 widechar in eucCN, which would
previously kick back an EILSEQ.
Reviewed by: bapt, rew
Sponsored by: Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D43262
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Previously the compiler's default C++ standard was used unlike C where
bsd.sys.mk explicitly sets a default language version. Setting an
explicit default version will give a more uniform experience across
different compilers and compiler versions.
gnu++17 was chosen to match the default C standard. It is well
supported by a wide range of clang (5+) and GCC (9+) versions.
gnu++17 is also the default C++ standard in recent versions of clang
(16+) and GCC (11+). As a result, many of the explicit CXXSTD
settings in Makefiles had the effect of lowering the C++ standard
instead of raising it as was originally intended and are removed.
Note that the remaining explicit CXXSTD settings for atf and liblutok
explicitly lower the standard to C++11 due to use of the deprecated
auto_ptr<> template which is removed in later versions.
Reviewed by: imp, asomers, dim, emaste
Differential Revision: https://reviews.freebsd.org/D49223
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
character classes
This change extends fnmatch to support collating symbol expressions,
equivalence class expressions, and character class expressions (as
defined by POSIX.1, section 9.3.5), along with the corresponding
tests.
Sponsored by: Klara, Inc.
Obtained from: https://github.com/apple-oss-distributions/Libc
Differential Revision: https://reviews.freebsd.org/D49660
Reviewed by: markj, ziaee (manpages)
|
| |
|
| |
|
|
|
|
| |
This matches FreeBSD style of test names.
|
| |
|
| |
|
|
|
|
|
|
| |
- The reason our test is flaky is its dependence on ip6addrctl_policy.
- While here, fix shell logic. When our diff(1) prints a diff it returns
a nonzero status and this is when we want to atf_fail().
|
|
|
|
| |
It is going to be modified in next commits.
|
|
|
|
|
|
|
| |
This adds a basic test that __cxa_atexit works, and also adds some tests
for __cxa_atexit handlers registered in the middle of __cxa_finalize.
PR: 285870
|
|
|
|
|
|
|
|
|
|
|
|
| |
Tests that require working name resolution or network access now mandate that
the kuya variable allow_network_access be set.
PR: 285826
Reported by: ngie
Reviewed by: igoro
Approved by: lwhsu
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D49633
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
A nameserver timeout is a soft failure, future attempts may succeed.
Returning EAI_AGAIN is crucial for API users to tell a soft name
resolution failure from negative resolution result.
Before the change we would return EAI_ADDRFAMILY, which I believe, is a
regression from 144361386696, and before that revision we used to return
EAI_NONAME in most of the cases.
Reviewed by: kib
Differential Revision: https://reviews.freebsd.org/D49411
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
A test suite for getaddrinfo(3) written in C. Unlike NetBSD test, this
one will be mostly focused on what the API should return when something
isn't good with your DNS. Test emulates bad DNS servers in resolv.conf
intercepting fopen(2) and emulates downed network intercepting send(2).
Initial version covers three main scenarios: all good, server(s) timed
out, network down. For each scenario we test hostname with trailing dot
and without, since libc resolver uses quite different code paths,
sometimes even yielding with different error codes. All current error
codes in the test are what our libc returns right now, meaning the test
documents what we have, not what there should be.
Reviewed by: kib
Differential Revision: https://reviews.freebsd.org/D49410
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Enable running of contrib/netbsd-tests/lib/libc/net/getaddrinfo without
modifications to the test program itself. However, create our own version
of expected results files. They are produced from the NetBSD files, with
the following list of changes:
o AF_INET6 value is different, hence: s/family 24/family 28/.
o SCTP result (socktype 5 protocol 132) needs to be added to many queries
results.
o NetBSD libc sorts multiple results first by protocol, then by address
family. FreeBSD first sorts on address family, then on protocol. Some
results need to be reordered.
o Error strings need to be fixed:
s/hostname nor servname provided, or not known/Name does not resolve/
s/ai_family not supported/Address family not recognized/
s/servname not supported for ai_socktype/\
Service was not recognized for socket type/.
Reviewed by: ngie, kib
Differential Revision: https://reviews.freebsd.org/D49409
|
|
|
|
|
|
|
|
|
|
|
| |
Instead of relying on any particular domainname and hostname to succeed,
spin up a jail before we execute the test with them set to some known,
fixed values. This allows them to be meaningfully tested -- previously,
they were skipped much more often than not.
Reported by: jlduran
Reviewed by: jlduran, markj
Differential Revision: https://reviews.freebsd.org/D49237
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
An upcoming test will require root to create a jail with its own
domainname/hostname to avoid external requirements on the test runner
as we want to fetch them with valid and plausible sizes.
Generate test headers for all cases to reduce churn in future diffs as
metadata is added to individual tests, or in case other test options
are added to correspond to different metadata to set.
Reviewed by: jlduran, markj
Differential Revision: https://reviews.freebsd.org/D49236
|