<feed xmlns='http://www.w3.org/2005/Atom'>
<title>src/lib/libc/db/hash, branch main</title>
<subtitle>FreeBSD source tree</subtitle>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/'/>
<entry>
<title>libc/dbm: Differentiate between uninitialized and end-of-db cursors</title>
<updated>2026-06-20T14:27:44+00:00</updated>
<author>
<name>Bojan Novković</name>
<email>bnovkov@FreeBSD.org</email>
</author>
<published>2026-06-19T15:24:05+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/commit/?id=f879eb3febb6c294d684e8e7fecd5cc396ec5a28'/>
<id>f879eb3febb6c294d684e8e7fecd5cc396ec5a28</id>
<content type='text'>
Commit `3a686b851f8f` fixed a `dbm_nextkey` edge case when using
the function after reaching the end of the database, but it inadvertently
broke the following `R_NEXT` behaviour:
"If the cursor is not yet set, this is the same as the R_FIRST flag."

Fix this by adding a new cursor constant that allows us to differentiate
between an unset cursor and a cursor that overflowed.

Reported by:	ae
Fixes:	3a686b851f8f
Sponsored by:	Klara, Inc.
Differential Revision:	https://reviews.freebsd.org/D57670
Reviewed by:	markj
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Commit `3a686b851f8f` fixed a `dbm_nextkey` edge case when using
the function after reaching the end of the database, but it inadvertently
broke the following `R_NEXT` behaviour:
"If the cursor is not yet set, this is the same as the R_FIRST flag."

Fix this by adding a new cursor constant that allows us to differentiate
between an unset cursor and a cursor that overflowed.

Reported by:	ae
Fixes:	3a686b851f8f
Sponsored by:	Klara, Inc.
Differential Revision:	https://reviews.freebsd.org/D57670
Reviewed by:	markj
</pre>
</div>
</content>
</entry>
<entry>
<title>libc/db: Remove unused hash functions in hash_func.c</title>
<updated>2026-03-24T10:34:55+00:00</updated>
<author>
<name>Bojan Novković</name>
<email>bnovkov@FreeBSD.org</email>
</author>
<published>2026-03-13T11:03:26+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/commit/?id=c09ccfc2665bef0d81d1db4e3713e4f2a0b5a064'/>
<id>c09ccfc2665bef0d81d1db4e3713e4f2a0b5a064</id>
<content type='text'>
Prune unused code hidden behind 'notdef', bringing us in sync with
the changes in OpenBSD. Despite the `__default_hash` function pointer
having external linkage, no ABI change is expected since it was
never exported.

Sponsored by:	Klara, Inc.
Differential Revision:	https://reviews.freebsd.org/D55842
Reviewed by:	allanjude, des
MFC after:	2 weeks
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Prune unused code hidden behind 'notdef', bringing us in sync with
the changes in OpenBSD. Despite the `__default_hash` function pointer
having external linkage, no ABI change is expected since it was
never exported.

Sponsored by:	Klara, Inc.
Differential Revision:	https://reviews.freebsd.org/D55842
Reviewed by:	allanjude, des
MFC after:	2 weeks
</pre>
</div>
</content>
</entry>
<entry>
<title>db/hash.c: Fix flag check in hash_seq</title>
<updated>2025-08-01T09:33:00+00:00</updated>
<author>
<name>Bojan Novković</name>
<email>bnovkov@FreeBSD.org</email>
</author>
<published>2025-08-01T09:33:00+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/commit/?id=aa05d1b2ef8b573bbd984273f72afa8a70376ae7'/>
<id>aa05d1b2ef8b573bbd984273f72afa8a70376ae7</id>
<content type='text'>
Fixes:	3a686b851f8f
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Fixes:	3a686b851f8f
</pre>
</div>
</content>
</entry>
<entry>
<title>dbm_nextkey: Always return an error if we've reached the end of the database</title>
<updated>2025-07-31T15:27:24+00:00</updated>
<author>
<name>Bojan Novković</name>
<email>bnovkov@FreeBSD.org</email>
</author>
<published>2025-07-30T14:39:54+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/commit/?id=3a686b851f8fda625010859d210c8a5615ea93fc'/>
<id>3a686b851f8fda625010859d210c8a5615ea93fc</id>
<content type='text'>
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
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
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
</pre>
</div>
</content>
</entry>
<entry>
<title>db/hash.c: Allow O_WRONLY in dbm_open</title>
<updated>2025-07-30T09:31:16+00:00</updated>
<author>
<name>Bojan Novković</name>
<email>bnovkov@FreeBSD.org</email>
</author>
<published>2025-07-25T09:01:52+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/commit/?id=14598537acecb512432e33e001762c912cc25799'/>
<id>14598537acecb512432e33e001762c912cc25799</id>
<content type='text'>
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
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
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
</pre>
</div>
</content>
</entry>
<entry>
<title>db/hash.c: Do not return an error when opening a missing database with O_CREAT</title>
<updated>2025-07-25T09:22:44+00:00</updated>
<author>
<name>Bojan Novković</name>
<email>bnovkov@FreeBSD.org</email>
</author>
<published>2025-07-24T15:07:34+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/commit/?id=108e2d1137aabc65db3cff545615e9e8927dbe23'/>
<id>108e2d1137aabc65db3cff545615e9e8927dbe23</id>
<content type='text'>
dbm_open currently returns an error when opening a missing database
with O_CREAT but creates the request database file. This is caused
by a buggy check in __hash_open which attempts to detect a new
(or empty) database file, but fails to take the O_CREAT flag into
account.

Fix this by expanding the check to include O_CREAT.

Fixes:	edcdc752ecdd
Sponsored by:	Klara, Inc.
Reviewed by:	markj
Differential Revision:	https://reviews.freebsd.org/D51491
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
dbm_open currently returns an error when opening a missing database
with O_CREAT but creates the request database file. This is caused
by a buggy check in __hash_open which attempts to detect a new
(or empty) database file, but fails to take the O_CREAT flag into
account.

Fix this by expanding the check to include O_CREAT.

Fixes:	edcdc752ecdd
Sponsored by:	Klara, Inc.
Reviewed by:	markj
Differential Revision:	https://reviews.freebsd.org/D51491
</pre>
</div>
</content>
</entry>
<entry>
<title>Remove residual blank line at start of Makefile</title>
<updated>2024-07-15T22:43:39+00:00</updated>
<author>
<name>Warner Losh</name>
<email>imp@FreeBSD.org</email>
</author>
<published>2024-07-15T04:46:32+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/commit/?id=e9ac41698b2f322d55ccf9da50a3596edb2c1800'/>
<id>e9ac41698b2f322d55ccf9da50a3596edb2c1800</id>
<content type='text'>
This is a residual of the $FreeBSD$ removal.

MFC After: 3 days (though I'll just run the command on the branches)
Sponsored by: Netflix
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This is a residual of the $FreeBSD$ removal.

MFC After: 3 days (though I'll just run the command on the branches)
Sponsored by: Netflix
</pre>
</div>
</content>
</entry>
<entry>
<title>lib: Remove ancient SCCS tags.</title>
<updated>2023-11-27T05:23:28+00:00</updated>
<author>
<name>Warner Losh</name>
<email>imp@FreeBSD.org</email>
</author>
<published>2023-11-23T17:21:37+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/commit/?id=dc36d6f9bb1753f3808552f3afd30eda9a7b206a'/>
<id>dc36d6f9bb1753f3808552f3afd30eda9a7b206a</id>
<content type='text'>
Remove ancient SCCS tags from the tree, automated scripting, with two
minor fixup to keep things compiling. All the common forms in the tree
were removed with a perl script.

Sponsored by:		Netflix
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Remove ancient SCCS tags from the tree, automated scripting, with two
minor fixup to keep things compiling. All the common forms in the tree
were removed with a perl script.

Sponsored by:		Netflix
</pre>
</div>
</content>
</entry>
<entry>
<title>libc: Purge unneeded cdefs.h</title>
<updated>2023-11-01T22:44:30+00:00</updated>
<author>
<name>Warner Losh</name>
<email>imp@FreeBSD.org</email>
</author>
<published>2023-11-01T22:43:37+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/commit/?id=559a218c9b257775fb249b67945fe4a05b7a6b9f'/>
<id>559a218c9b257775fb249b67945fe4a05b7a6b9f</id>
<content type='text'>
These sys/cdefs.h are not needed. Purge them. They are mostly left-over
from the $FreeBSD$ removal. A few in libc are still required for macros
that cdefs.h defines. Keep those.

Sponsored by:		Netflix
Differential Revision:	https://reviews.freebsd.org/D42385
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
These sys/cdefs.h are not needed. Purge them. They are mostly left-over
from the $FreeBSD$ removal. A few in libc are still required for macros
that cdefs.h defines. Keep those.

Sponsored by:		Netflix
Differential Revision:	https://reviews.freebsd.org/D42385
</pre>
</div>
</content>
</entry>
<entry>
<title>Remove $FreeBSD$: one-line sh pattern</title>
<updated>2023-08-16T17:55:03+00:00</updated>
<author>
<name>Warner Losh</name>
<email>imp@FreeBSD.org</email>
</author>
<published>2023-08-16T17:55:03+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/commit/?id=d0b2dbfa0ecf2bbc9709efc5e20baf8e4b44bbbf'/>
<id>d0b2dbfa0ecf2bbc9709efc5e20baf8e4b44bbbf</id>
<content type='text'>
Remove /^\s*#[#!]?\s*\$FreeBSD\$.*$\n/
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Remove /^\s*#[#!]?\s*\$FreeBSD\$.*$\n/
</pre>
</div>
</content>
</entry>
</feed>
