Guillem Jover [Sun, 17 May 2026 21:01:52 +0000 (23:01 +0200)]
man: Disable hyphenation globally for all man pages
There is no place for hyphenation in a technical document. Unfortunately
groff insists on hyphenating words that are known to be technical terms
such as in .Xr, or .Fn, etc. Where groff upstream suggests that those
words need to be marked up with things like \%, which looks like
unnecessary busy work.
The current workaround requires to use low-level troff markup to
globally disable hyphenation with groff, which is less than ideal, but
the best known option available.
Sven Püschel [Tue, 28 Oct 2025 11:11:36 +0000 (12:11 +0100)]
build: Check sanitize argument value
Check the value of the sanitize argument to determine if sanitize should
be enabled. This fixes that sanitize is enabled when --disable-sanitize
is passed to the configure script.
The third AC_ARG_ENABLE parameter defines an action, if the parameter is
present, but doesn't check its value. Therefore it is also invoked if the
parameter is disabled or --enable-foo=no is set. Therefore don't define
these actions and instead check the value with an AS_IF statement
afterwards, as shown in [1].
Guillem Jover [Mon, 18 May 2026 02:55:05 +0000 (04:55 +0200)]
build: Switch to debian:unstable Docker image
We have a restricted enough amount of dependencies that relying on
Debian unstable seems safe. More than using debian:testing which might
end up stuck with problems for some time until packages migrate from
unstable.
Guillem Jover [Fri, 8 May 2026 03:40:20 +0000 (05:40 +0200)]
build: Set TAR_OPTIONS to avoid leaking maintainer information on dist
The default tar invocation by automake leaks the user and group IDs and
names into the tarball. And while those are probably going to be easy to
infer, it is unnecessary to expose them. With the automake switch from
tar format v7 to ustar this is now worse as it used to only leak the
IDs, not the names.
We set and export TAR_OPTIONS with --owner=0 and --group=0 to neuter the
information leak. Although ideally automake would set those by default.
Guillem Jover [Sat, 16 May 2026 15:00:58 +0000 (17:00 +0200)]
doc: Use SPDX identifier for libutil-David-Nugent license in COPYING
The current name (BSD-5-clause-Peter-Wemm) is very confusing as it gives
it legitimacy as one of the recognized BSD-N-clause licenses, and it
also makes it seem more restrictive than a BSD-4-clause license, which
it does not appear to be. The license seems to originate from libutil
files by David Nugent, and that's the name that it got when being added
into SPDX. We switch to use that as a known registered name instead of
making it up ourselves.
Guillem Jover [Sat, 16 May 2026 15:29:58 +0000 (17:29 +0200)]
doc: Coalesce copyright years into ranges in COPYING file
For copyright, the important dates are the first date of publication,
and the last date of publication. The latter for anonymous and
pseudonymous authors where there's a fixed time after last publication
(usually at least 50 years or more), and the former for known authors
where there's a fixed time after first publication or author's death
(usually at least 50 years or more).
It seems fine to coalesce the copyright years in the COPYING file, as
this is a summary of the original statements found in the actual source
files, were we are here already inserting the different years or ranges,
so making it a single range preserves the important information that
might be relevant for compliance purposes.
Guillem Jover [Mon, 13 Mar 2023 23:58:45 +0000 (00:58 +0100)]
doc: Remove «All rights reserved»
This has no legal weight, and was needed due to the Buenos Aires
Convention requiring it. Since all members of the Buenos Aires
Convention are now part of the Berne Convention, there is no need
anymore for this phrasing. And while the original statement must not
be touched, we do not need to replicate this in the COPYING file when
it is legally pointless.
Guillem Jover [Sat, 2 Nov 2024 22:14:11 +0000 (23:14 +0100)]
include: Switch from __unused to new LIBBSD_UNUSED
Because we do not define __unused, as on GNU systems Linux and glibc
providing conflicting symbols, declarations for imported functions that
use that attribute cause build failures when used.
Guillem Jover [Sat, 2 Nov 2024 22:12:40 +0000 (23:12 +0100)]
include: Refactor «unused» attribute into new LIBBSD_UNUSED macro
This make it possible to declare function arguments in headers as
potentially unused, so that they do not emit warnings. We will use this
instead of the BSD __unused, which we cannot currently enable on GNU
systems due to Linux and glibc having conflicting symbols.
Sam James [Wed, 13 Mar 2024 23:34:55 +0000 (23:34 +0000)]
test: nlist: make resilient against -Wl,--gc-sections
With linker sections GC enabled, we get a test failure in `nlist.c`:
```
nlist: nlist.c:72: main: Assertion `rc == 0' failed.
```
This turns out to be because several sections used by the test can be discarded:
```
ld: removing unused section '.text.func_pub' in file 'nlist.o'
ld: removing unused section '.bss.data_pub_uninit' in file 'nlist.o'
ld: removing unused section '.data.data_pub_init' in file 'nlist.o'
```
Reproduced with `CFLAGS="-Og -fdata-sections -ffunction-sections"` and
`LDFLAGS="-Wl,-O1 -Wl,--as-needed -Wl,--gc-sections -Wl,-z,start-stop-gc"`.
Additionally, `LDFLAGS="... -Wl,--print-gc-sections"` can help with diagnosing
which sections get removed.
We already mark these symbols as `used`, but we need `retain` [0] for them
to survive linker GC too.
Guillem Jover [Tue, 12 Mar 2024 23:56:07 +0000 (00:56 +0100)]
build: Only install time struct conversion macros where missing
These macros are available in several systems, and we should not install
the man pages for them, otherwise we might end up shadowing the system
man pages if present.
Guillem Jover [Mon, 12 Feb 2024 00:04:37 +0000 (01:04 +0100)]
Add vasprintf() and asprintf() functions missing on AIX
These functions are used by code in the library, even though these
functions started as GNU extensions, they are present in all BSDs,
so we expose them as part of our interface on AIX.
Guillem Jover [Sun, 11 Feb 2024 22:55:40 +0000 (23:55 +0100)]
build: Make almost all exposed interfaces use the new ABI selection
Explicitly select what to include as part of the target ABI, instead of
letting autoconfiguration potentially break ABI if the system grows
functionality provided by the library.
Make almost all the library selectable per target. Do not install manual
pages for interfaces not included in the library. Control inclusion of
symbols in map file via pre-processor macros, and move the comments
describing the ABI selection to configure.ac.
For now the header files are included as is and filtered through
pre-processor conditionals. Eventually they might get switched to be
autogenerated at build time.
Guillem Jover [Wed, 14 Feb 2024 03:59:44 +0000 (04:59 +0100)]
build: Rework ABI selection logic
Add a new LIBBSD_SELECT_ABI m4 macro, and use it to setup the ABI
interfaces to expose and the various variables and conditionals
to be used by the build system.
Switch to set the initial values to unknown and then set every one
of the selections explicitly by supported target.
Update comments for rationale for things to DROP, or for why some
selections are enabled.
Guillem Jover [Tue, 20 Feb 2024 03:28:01 +0000 (04:28 +0100)]
build: Make digest function checks conditional on their use
The digest function checks where unconditionally requiring the functions
to exist or they would error out. But these functions are not required
on all systems, they depend on the ABI to be exposed.
Guillem Jover [Tue, 20 Feb 2024 03:13:59 +0000 (04:13 +0100)]
build: Move ABI selection at the top of configure.ac
Merge the existing host_os block for the OS detection with the ABI
selection one, as these are related. This way we will be able to make
some of the latter checks conditional on the selected ABI.
Guillem Jover [Sat, 17 Feb 2024 04:25:01 +0000 (05:25 +0100)]
Split errc family of functions from err ones
On most systems the err family of functions is already present, but are
missing the errc family of functions, which are also present on some
other systems. Splitting them into separate files will make it easer to
conditionally include one or the other.
Guillem Jover [Sat, 17 Feb 2024 02:07:58 +0000 (03:07 +0100)]
Sync strtoi()/strtou() implementations from NetBSD
These contain the fixes to the error handling logic.
In NetBSD the manual page for strtou.3 is generated from the strtoi.3
manual page applying some substitutions, the problem is that the
cross-references are then lost. We will still keep them separate.
Guillem Jover [Sun, 11 Feb 2024 18:35:05 +0000 (19:35 +0100)]
build: Generate the map file from the configured ABI
Some linkers require the map file definitions to contain only symbols
that are present on the linked object, either in the map file or in the
sym file we generate from the map file.
This is preparatory work to be able to conditionally include symbols
in the man and sym files depending on the ABI definitions.
Guillem Jover [Sun, 11 Feb 2024 23:06:56 +0000 (00:06 +0100)]
build: Make name_from_id man pages conditional instead of id_from_name
The code is only making the name_from_id function conditional, and
assumes id_from_name are always to be included, so we need to match
the logic for the man page inclusion.
Guillem Jover [Mon, 8 Jan 2024 22:40:31 +0000 (23:40 +0100)]
man: Fix manual page references
When referring to another manual page and their section number, we need
to use Xr instead of Fn, otherwise the section number is interpreted as
a function argument. For functions provided by libbsd itself we should
be using the 3bsd section instead of 3.
Guillem Jover [Mon, 8 Jan 2024 00:58:54 +0000 (01:58 +0100)]
test: Close all descriptors before initializing them for closefrom()
On macOS, closefrom() only sets the close-on-exec flag, so we cannot
check whether all file descriptors were closed, which means that if
on entry our file descriptor table was filled after the 4th file
descriptor, then we might fail the assertions for the flags for odd
file descriptors which we expect to be closed.
This can easily happen when running the test suite in parallel mode
with «make -j8 check» for example.
The <sys/*> headers tend to define things that might be used by other
headers, so while they should be self-contained, it is better to simply
include them first.
build: Do not build the progname module if it is not needed
This was made conditional, but the code part was accidentally left
untouched due to having ported it locally to use __progname, which
caused build failures on the stock repo.
Move the version script comments before the symbols
When generating the .sym export file from the .map file, we are not
stripping these comments that are part of the same line as the symbol,
which causes ld(1) implementations to error out. Moving them before
the symbols avoids the need to strip them, as we are only keeping
actual symbol lines.
Although the function is documented as possibly returning NULL if it
cannot find a known source of information, we should still at least
attempt to port it to any supported system, and otherwise explicitly
mark it as not implementable for such systems if that was to be the
case.
build: Select whether to include funopen() in the build system
This makes sure we include it when expected, alongside the man pages,
and the test cases, and do not accidentally break the ABI if the system
starts providing such interface.
build: Move Windows OS detection to the OS features section
This was placed here to make use of the same AS_CASE, but it does not
really fit with the section. Move it to the more appropriate place, and
detangle the AS_CASE.
build: Add a new libbsd_strong_alias() macro and switch users to it
We had several cases of code needing a strong alias, so we switch those
to use the new macro. This covers systems that support the alias
attribute and others such as macOS where we need to use assembler
directives to add the alias as the attribute is not supported.