<feed xmlns='http://www.w3.org/2005/Atom'>
<title>src/lib/libc/tests/gen, branch main</title>
<subtitle>FreeBSD source tree</subtitle>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/'/>
<entry>
<title>libc/tests: Clean up *dir() tests</title>
<updated>2026-02-03T14:39:32+00:00</updated>
<author>
<name>Dag-Erling Smørgrav</name>
<email>des@FreeBSD.org</email>
</author>
<published>2026-02-03T14:39:21+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/commit/?id=d70b9eb74fc4aa430bd2ff4bca37e6a9b6c8004f'/>
<id>d70b9eb74fc4aa430bd2ff4bca37e6a9b6c8004f</id>
<content type='text'>
Mainly, avoid reusing the name of one of the functions we should be
testing (but aren't) for local variables.

Sponsored by:	Klara, Inc.
Reviewed by:	markj
Differential Revision:	https://reviews.freebsd.org/D55054
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Mainly, avoid reusing the name of one of the functions we should be
testing (but aren't) for local variables.

Sponsored by:	Klara, Inc.
Reviewed by:	markj
Differential Revision:	https://reviews.freebsd.org/D55054
</pre>
</div>
</content>
</entry>
<entry>
<title>libc/limits_test: add no-op testcase to satisfy kyua</title>
<updated>2025-12-05T14:12:46+00:00</updated>
<author>
<name>Siva Mahadevan</name>
<email>me@svmhdvn.name</email>
</author>
<published>2025-10-23T13:17:25+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/commit/?id=27ff0bbcfd27df588d3f486cb21180a26031b889'/>
<id>27ff0bbcfd27df588d3f486cb21180a26031b889</id>
<content type='text'>
This test suite is purely tested with compile-time assertions, so
it needs a dummy runtime test to ensure that kyua reports the
file as passing.

Pull Request:	https://github.com/freebsd/freebsd-src/pull/1915
Sponsored by:	The FreeBSD Foundation
Reviewed by:	fuz
Approved by:	markj (mentor)
MFC after:	1 month
Signed-off-by:	Siva Mahadevan &lt;me@svmhdvn.name&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This test suite is purely tested with compile-time assertions, so
it needs a dummy runtime test to ensure that kyua reports the
file as passing.

Pull Request:	https://github.com/freebsd/freebsd-src/pull/1915
Sponsored by:	The FreeBSD Foundation
Reviewed by:	fuz
Approved by:	markj (mentor)
MFC after:	1 month
Signed-off-by:	Siva Mahadevan &lt;me@svmhdvn.name&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>libc/tests: add test for *_MAX, *_MIN, and *_WIDTH</title>
<updated>2025-11-30T19:21:51+00:00</updated>
<author>
<name>Robert Clausecker</name>
<email>fuz@FreeBSD.org</email>
</author>
<published>2025-11-19T19:26:11+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/commit/?id=4a1c7529c96ff54657ef701fa89b92230ee6bac2'/>
<id>4a1c7529c96ff54657ef701fa89b92230ee6bac2</id>
<content type='text'>
This file checks the correctness of the various _MAX, _MIN, and
_WIDTH macros defined for the libc types.  It assumes that none
of the types have padding bits.

Approved by:	markj (mentor)
MFC after:	1 month
Differential Revision:	https://reviews.freebsd.org/D53831
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This file checks the correctness of the various _MAX, _MIN, and
_WIDTH macros defined for the libc types.  It assumes that none
of the types have padding bits.

Approved by:	markj (mentor)
MFC after:	1 month
Differential Revision:	https://reviews.freebsd.org/D53831
</pre>
</div>
</content>
</entry>
<entry>
<title>realpath: Report correct path on failure</title>
<updated>2025-10-13T11:53:52+00:00</updated>
<author>
<name>Dag-Erling Smørgrav</name>
<email>des@FreeBSD.org</email>
</author>
<published>2025-10-13T11:53:22+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/commit/?id=1406de21e176d8700240ac9e473df007cd41eec1'/>
<id>1406de21e176d8700240ac9e473df007cd41eec1</id>
<content type='text'>
If lstat() fails with EACCES or ENOTDIR, the path we need to return in
the caller-provided buffer is that of the parent directory (which is
either unreadable or not a directory; the latter can only happen in the
case of a race) rather than that of the child we attempted to stat.

Sponsored by:	Klara, Inc.
Reviewed by:	markj
Differential Revision:	https://reviews.freebsd.org/D53025
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
If lstat() fails with EACCES or ENOTDIR, the path we need to return in
the caller-provided buffer is that of the parent directory (which is
either unreadable or not a directory; the latter can only happen in the
case of a race) rather than that of the child we attempted to stat.

Sponsored by:	Klara, Inc.
Reviewed by:	markj
Differential Revision:	https://reviews.freebsd.org/D53025
</pre>
</div>
</content>
</entry>
<entry>
<title>realpath: Additional test cases</title>
<updated>2025-10-13T11:53:51+00:00</updated>
<author>
<name>Dag-Erling Smørgrav</name>
<email>des@FreeBSD.org</email>
</author>
<published>2025-10-13T11:53:04+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/commit/?id=f3386dfeb429faaa30a915a4a422a25e07c8bf39'/>
<id>f3386dfeb429faaa30a915a4a422a25e07c8bf39</id>
<content type='text'>
* Passing NULL should result in EINVAL
* Passing an empty path should result in ENOENT
* Failure with a non-null buffer should leave a partial result.  As
  pointed out in a comment in the test case, this reveals a discrepancy
  between the documentation and reality.

Sponsored by:	Klara, Inc.
Reviewed by:	markj
Differential Revision:	https://reviews.freebsd.org/D53024
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
* Passing NULL should result in EINVAL
* Passing an empty path should result in ENOENT
* Failure with a non-null buffer should leave a partial result.  As
  pointed out in a comment in the test case, this reveals a discrepancy
  between the documentation and reality.

Sponsored by:	Klara, Inc.
Reviewed by:	markj
Differential Revision:	https://reviews.freebsd.org/D53024
</pre>
</div>
</content>
</entry>
<entry>
<title>libc: gen: refactor execvPe() for readability</title>
<updated>2025-08-03T04:15:03+00:00</updated>
<author>
<name>Kyle Evans</name>
<email>kevans@FreeBSD.org</email>
</author>
<published>2025-08-03T04:15:03+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/commit/?id=702423e864a5a297713566ea74a62723a9c68a72'/>
<id>702423e864a5a297713566ea74a62723a9c68a72</id>
<content type='text'>
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
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
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
</pre>
</div>
</content>
</entry>
<entry>
<title>readdir: Fix error check.</title>
<updated>2025-07-11T20:43:32+00:00</updated>
<author>
<name>Dag-Erling Smørgrav</name>
<email>des@FreeBSD.org</email>
</author>
<published>2025-07-11T20:43:20+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/commit/?id=920b2183919e430cf85c4aa1fa337bfded12aee5'/>
<id>920b2183919e430cf85c4aa1fa337bfded12aee5</id>
<content type='text'>
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
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
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
</pre>
</div>
</content>
</entry>
<entry>
<title>wordexp(3): Handle ECHILD from waitpid</title>
<updated>2025-07-08T21:27:33+00:00</updated>
<author>
<name>Kenny Levinsen</name>
<email>kl@kl.wtf</email>
</author>
<published>2025-04-21T12:13:43+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/commit/?id=da9e73e5d483c47e67b3094356dd4b640749849e'/>
<id>da9e73e5d483c47e67b3094356dd4b640749849e</id>
<content type='text'>
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 &lt;kl@kl.wtf&gt;
Tested by: Jan Beich
Pull Request: https://github.com/freebsd/freebsd-src/pull/1675
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
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 &lt;kl@kl.wtf&gt;
Tested by: Jan Beich
Pull Request: https://github.com/freebsd/freebsd-src/pull/1675
</pre>
</div>
</content>
</entry>
<entry>
<title>opendir, fdopendir: Add tests, clean up.</title>
<updated>2025-07-08T19:41:21+00:00</updated>
<author>
<name>Dag-Erling Smørgrav</name>
<email>des@FreeBSD.org</email>
</author>
<published>2025-07-08T19:40:55+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/commit/?id=c08e019c6ce4fc637b195f1bb0878763c3fefe9e'/>
<id>c08e019c6ce4fc637b195f1bb0878763c3fefe9e</id>
<content type='text'>
* 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
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
* 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
</pre>
</div>
</content>
</entry>
<entry>
<title>fts: Add test cases for unreadable directories.</title>
<updated>2025-07-02T10:22:29+00:00</updated>
<author>
<name>Dag-Erling Smørgrav</name>
<email>des@FreeBSD.org</email>
</author>
<published>2025-07-02T10:22:16+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/commit/?id=8d02b7190d3b926118fafc6a70a80676c349e186'/>
<id>8d02b7190d3b926118fafc6a70a80676c349e186</id>
<content type='text'>
Sponsored by:	Klara, Inc.
Reviewed by:	kevans
Differential Revision:	https://reviews.freebsd.org/D51098
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Sponsored by:	Klara, Inc.
Reviewed by:	kevans
Differential Revision:	https://reviews.freebsd.org/D51098
</pre>
</div>
</content>
</entry>
</feed>
