]> git.ipfire.org Git - thirdparty/libbsd.git/log
thirdparty/libbsd.git
15 months agoRelease libbsd 0.12.2 main 0.12.2
Guillem Jover [Mon, 18 Mar 2024 02:17:06 +0000 (03:17 +0100)] 
Release libbsd 0.12.2

15 months agotest: nlist: make resilient against -Wl,--gc-sections
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.

[0] https://releases.llvm.org/18.1.0/tools/lld/docs/ELF/start-stop-gc.html#annotate-c-identifier-name-sections

Closes: !29
Signed-off-by: Sam James <sam@gentoo.org>
Signed-off-by: Guillem Jover <guillem@hadrons.org>
15 months agobuild: Do not rely on internal autoconf ac_cv_sys_file_offset_bits variable
Guillem Jover [Thu, 14 Mar 2024 00:56:36 +0000 (01:56 +0100)] 
build: Do not rely on internal autoconf ac_cv_sys_file_offset_bits variable

This is an internal implementation detail from AC_SYS_LARGEFILE, which
happened to change with autoconf 2.72. Instead compute our own size
for off_t.

Closes: #28
15 months agobuild: Use -eq instead of = as test operators for arithmetic tests
Guillem Jover [Thu, 14 Mar 2024 00:59:19 +0000 (01:59 +0100)] 
build: Use -eq instead of = as test operators for arithmetic tests

15 months agobuild: Fix typo in ABI selection description
Guillem Jover [Tue, 12 Mar 2024 23:56:59 +0000 (00:56 +0100)] 
build: Fix typo in ABI selection description

15 months agobuild: Only install time struct conversion macros where missing
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.

15 months agoman: Add links for errc module functions
Guillem Jover [Sun, 10 Mar 2024 17:01:02 +0000 (18:01 +0100)] 
man: Add links for errc module functions

Reported-by: Alejandro Colomar <alx@kernel.org>
15 months agoman: Do not install timeval(3bsd) nor timespec(3bsd)
Guillem Jover [Fri, 8 Mar 2024 02:05:24 +0000 (03:05 +0100)] 
man: Do not install timeval(3bsd) nor timespec(3bsd)

These are system types, which we should not be documenting. Rewrite the
man pages around the TIMEVAL_TO_TIMESPEC and TIMESPEC_TO_TIMEVAL macros.

16 months agostrtonum: Do not abort on EINVAL from strtoi()
Duncan Overbruck [Tue, 5 Mar 2024 16:02:32 +0000 (17:02 +0100)] 
strtonum: Do not abort on EINVAL from strtoi()

With musl libc strtoimax(".", ...) returns EINVAL.

Closes: !28
Signed-off-by: Guillem Jover <guillem@hadrons.org>
16 months agoclosefrom: Ignore files starting with dot when scanning /proc/self/fd
Duncan Overbruck [Tue, 5 Mar 2024 16:01:29 +0000 (17:01 +0100)] 
closefrom: Ignore files starting with dot when scanning /proc/self/fd

Signed-off-by: Guillem Jover <guillem@hadrons.org>
16 months agobuild: Match also gnu* for GNU/Hurd on the glibc ABI selection
Guillem Jover [Wed, 6 Mar 2024 01:12:56 +0000 (02:12 +0100)] 
build: Match also gnu* for GNU/Hurd on the glibc ABI selection

The GNU/Hurd system does not specify a kernel part, so we need to match
on both *-gnu* and gnu* (to avoid overmatching with just *gnu*).

16 months agoRelease libbsd 0.12.1 0.12.1
Guillem Jover [Wed, 28 Feb 2024 03:50:34 +0000 (04:50 +0100)] 
Release libbsd 0.12.1

16 months agobuild: Add a comment to libbsd-overlay.pc about -isystem usage
Guillem Jover [Wed, 28 Feb 2024 03:44:02 +0000 (04:44 +0100)] 
build: Add a comment to libbsd-overlay.pc about -isystem usage

Add the reasoning for why we use -isystem instead of -I, to avoid
confusing unsuspecting readers of the file.

Prompted-by: Alejandro Colomar <alx@kernel.org>
16 months agobuild: Install err.h if either of the err or errc modules are built
Guillem Jover [Wed, 28 Feb 2024 03:37:44 +0000 (04:37 +0100)] 
build: Install err.h if either of the err or errc modules are built

Both modules expose their functions in err.h, so we need to install it
whenever any of them is being built.

Reported-by: Alejandro Colomar <alx@kernel.org>
16 months agoRelease libbsd 0.12.0 0.12.0
Guillem Jover [Tue, 27 Feb 2024 04:52:53 +0000 (05:52 +0100)] 
Release libbsd 0.12.0

16 months agoAdd explicit time32 and time64 support
Guillem Jover [Fri, 9 Feb 2024 03:32:12 +0000 (04:32 +0100)] 
Add explicit time32 and time64 support

Handle the three potential system scenarios:

 - system time_t is time64
 - system time_t is time32 and supports time64
 - system time_t is time32 and does not support time64

Add the explicit time32 and time64 functions when necessary and map
them accordingly for each of these cases.

16 months agobuild: Add support for AIX
Guillem Jover [Mon, 12 Feb 2024 02:00:06 +0000 (03:00 +0100)] 
build: Add support for AIX

16 months agoAdd vasprintf() and asprintf() functions missing on AIX
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.

16 months agobuild: Add support for Solaris
Guillem Jover [Mon, 12 Feb 2024 01:55:08 +0000 (02:55 +0100)] 
build: Add support for Solaris

16 months agobuild: Make almost all exposed interfaces use the new ABI selection
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.

16 months agobuild: Rework ABI selection logic
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.

16 months agobuild: Rename ABI selection variables from need_ to abi_
Guillem Jover [Wed, 14 Feb 2024 03:59:44 +0000 (04:59 +0100)] 
build: Rename ABI selection variables from need_ to abi_

This should make the purpose of these variables more clear.

16 months agobuild: Revert accidental testing aid change
Guillem Jover [Wed, 21 Feb 2024 01:29:15 +0000 (02:29 +0100)] 
build: Revert accidental testing aid change

This was accidentally included in the commit, but should have only been
used during development.

Fixes: commit de124dcafac678351366b0572938398ea7ae93e4
Changelog: silent

16 months agobuild: Make digest function checks conditional on their use
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.

16 months agobuild: Move ABI selection at the top of configure.ac
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.

16 months agobuild: Sort variables and their contents in automake files
Guillem Jover [Sun, 11 Feb 2024 22:55:40 +0000 (23:55 +0100)] 
build: Sort variables and their contents in automake files

This should make it easier to add new entries, and find them afterwards.

16 months agobuild: Rename LIBBSD_ABI to SOVERSION
Guillem Jover [Wed, 21 Feb 2024 01:05:57 +0000 (02:05 +0100)] 
build: Rename LIBBSD_ABI to SOVERSION

This matches the semantics of the variable, and makes it independent of
the project, just as the package variables.

16 months agobuild: Refactor function checks into a new libbsd-funcs.m4 file
Guillem Jover [Tue, 20 Feb 2024 03:40:32 +0000 (04:40 +0100)] 
build: Refactor function checks into a new libbsd-funcs.m4 file

These are complex enough to clutter the main configure.ac. Move them
into their own file.

16 months agobuild: Remove space before shell redirection
Guillem Jover [Tue, 20 Feb 2024 02:57:37 +0000 (03:57 +0100)] 
build: Remove space before shell redirection

This makes it more clear what the redirection applies to.

16 months agobuild: Add support for silent rules for the libbsd.map generation
Guillem Jover [Sun, 18 Feb 2024 19:40:24 +0000 (20:40 +0100)] 
build: Add support for silent rules for the libbsd.map generation

The new rule was introduced w/o silent rule support.

Fixes: commit 19e06407eb365a2bedc9bdd29a83c1e1803e3f92
16 months agoSplit errc family of functions from err ones
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.

16 months agoSync strtoi()/strtou() implementations from NetBSD
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.

Reported-by: Alejandro Colomar <alx@kernel.org>
16 months agobuild: Swap symbol and alias arguments order in macros creating aliases
Guillem Jover [Wed, 14 Feb 2024 02:39:16 +0000 (03:39 +0100)] 
build: Swap symbol and alias arguments order in macros creating aliases

The current order is rather confusing, pass the real symbol first
and the alias we want to create next.

16 months agobuild: Generate the map file from the configured ABI
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.

16 months agobuild: Make name_from_id man pages conditional instead of id_from_name
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.

17 months agoman: Mention that funopen() can be made available on musl
Guillem Jover [Mon, 8 Jan 2024 22:57:45 +0000 (23:57 +0100)] 
man: Mention that funopen() can be made available on musl

As musl got fopencookie() implemented in 1.1.19, the funopen() function
can also be provided there. Note this in the documentation.

17 months agoman: Fix manual page references
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.

17 months agoman: Add closefrom(), strlcpy() and strlcat() as superseded functions
Guillem Jover [Mon, 8 Jan 2024 22:39:19 +0000 (23:39 +0100)] 
man: Add closefrom(), strlcpy() and strlcat() as superseded functions

These were missing from the list of functions provided by some libc
implementation.

17 months agodoc: Use macOS to refer to the operating system
Guillem Jover [Mon, 8 Jan 2024 22:37:43 +0000 (23:37 +0100)] 
doc: Use macOS to refer to the operating system

This is the correct spelling, instead of capitalizing it.

17 months agoRelease libbsd 0.11.8 0.11.8
Guillem Jover [Mon, 8 Jan 2024 01:16:12 +0000 (02:16 +0100)] 
Release libbsd 0.11.8

17 months agotest: Close all descriptors before initializing them for closefrom()
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.

Closes: #23
17 months agobuild: Check out-of-tree builds in CI
Guillem Jover [Fri, 27 Oct 2023 22:52:31 +0000 (00:52 +0200)] 
build: Check out-of-tree builds in CI

Make sure the out-of-tree builds do not regress.

17 months agoAdjust strlcpy() and strlcat() per glibc adoption
Guillem Jover [Sun, 7 Jan 2024 16:43:12 +0000 (17:43 +0100)] 
Adjust strlcpy() and strlcat() per glibc adoption

These functions were added in glibc 2.38, in anticipation of POSIX
adopting them too.

Closes: #26
17 months agoDo not add a pointer to the NULL constant
Guillem Jover [Tue, 14 Nov 2023 18:15:11 +0000 (19:15 +0100)] 
Do not add a pointer to the NULL constant

Warned-by: cppcheck (nullPointerArithmetic)
17 months agoDo not confuse code analyzers with out-of-bounds array access look alike
Guillem Jover [Tue, 14 Nov 2023 18:09:25 +0000 (19:09 +0100)] 
Do not confuse code analyzers with out-of-bounds array access look alike

The code is only getting the address, but we might be performing an
addressing that is out-of-bounds. Avoid it and use the address form
instead.

Warned-by: cppcheck (objectIndex)
17 months agotest: Fix short-lived memory leak
Guillem Jover [Tue, 14 Nov 2023 18:08:15 +0000 (19:08 +0100)] 
test: Fix short-lived memory leak

Warned-by: cppcheck
20 months agobuild: Add a coverage regex to the CI job
Guillem Jover [Fri, 27 Oct 2023 22:47:26 +0000 (00:47 +0200)] 
build: Add a coverage regex to the CI job

This is needed so that gitlab can know where to extract the coverage
percentage from in the output, to be able to track and report it.

20 months agoman: Use VARIANTS instead of ALTERNATIVES in libbsd(7)
Guillem Jover [Mon, 9 Oct 2023 23:53:32 +0000 (01:53 +0200)] 
man: Use VARIANTS instead of ALTERNATIVES in libbsd(7)

Using alternatives seems confusing in this context.

20 months agoman: Markup function references with Xr instead of Fn
Guillem Jover [Mon, 9 Oct 2023 23:52:37 +0000 (01:52 +0200)] 
man: Markup function references with Xr instead of Fn

These references had man page sections in them, so using Fn meant that
these appeared as function arguments.

22 months agobuild: Add missing dash to macro title bar
Guillem Jover [Tue, 5 Sep 2023 01:02:44 +0000 (03:02 +0200)] 
build: Add missing dash to macro title bar

22 months agopwcache: Do not declare uidtb and gidtb when not used
Guillem Jover [Thu, 27 Jul 2023 11:57:51 +0000 (13:57 +0200)] 
pwcache: Do not declare uidtb and gidtb when not used

When the system provides implementations for user_from_uid() or
group_from_gid() we are not using these variables, so better not declare
them.

Fixes: commit 21d12b02112097f0c195dceb1892c95b7b957b36
22 months agofgetln: Include <stdio.h> after <sys/*>
Guillem Jover [Thu, 27 Jul 2023 11:39:00 +0000 (13:39 +0200)] 
fgetln: Include <stdio.h> after <sys/*>

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.

22 months agobuild: Refactor GNU .init_array support check into a new m4 function
Guillem Jover [Fri, 26 May 2023 21:55:40 +0000 (23:55 +0200)] 
build: Refactor GNU .init_array support check into a new m4 function

23 months agobuild: Refactor linker script detection into a new m4 function
Guillem Jover [Fri, 26 May 2023 21:50:10 +0000 (23:50 +0200)] 
build: Refactor linker script detection into a new m4 function

23 months agobuild: Do not provide prototypes for arc4random() on Solaris
Guillem Jover [Thu, 27 Jul 2023 11:51:36 +0000 (13:51 +0200)] 
build: Do not provide prototypes for arc4random() on Solaris

These functions are provided by the system.

23 months agobuild: Do not build the progname module if it is not needed
Guillem Jover [Sat, 22 Apr 2023 18:47:20 +0000 (20:47 +0200)] 
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.

Fixes: commit 046621d7967e7a0f08ae988bcf7e4cd1b6cf204c
2 years agobuild: Sort entries alphabetically
Guillem Jover [Sun, 23 Apr 2023 00:04:47 +0000 (02:04 +0200)] 
build: Sort entries alphabetically

2 years agobuild: Conditionalize wcslcpy() and wcslcat() functions on macOS
Guillem Jover [Sun, 23 Apr 2023 00:05:04 +0000 (02:05 +0200)] 
build: Conditionalize wcslcpy() and wcslcat() functions on macOS

These functions are provided by the system libc.

2 years agobuild: Conditionalize only id-from-name functions not the entire pwcache
Guillem Jover [Sun, 23 Apr 2023 00:00:10 +0000 (02:00 +0200)] 
build: Conditionalize only id-from-name functions not the entire pwcache

On macOS the name-from-id functions are present, but not the
id-from-name ones, so we want to provide those instead of suppressing
the entire file.

2 years agobuild: Conditionalize getprogname()/setprogname on macOS
Guillem Jover [Sat, 22 Apr 2023 20:47:10 +0000 (22:47 +0200)] 
build: Conditionalize getprogname()/setprogname on macOS

These functions are provided by the system libc, so there is no need for
us to provide them.

2 years agoprogname: Include <procinfo.h> if available
Guillem Jover [Sat, 22 Apr 2023 18:23:08 +0000 (20:23 +0200)] 
progname: Include <procinfo.h> if available

We need this header on AIX. Missed transplanting the code from the AIX
porting system.

Fixes: commit 9fa06763a1afe0946a3a20e5bbdba72885cbade5
2 years agobuild: Check whether we need libperfstat on AIX
Guillem Jover [Tue, 18 Apr 2023 01:56:16 +0000 (03:56 +0200)] 
build: Check whether we need libperfstat on AIX

The getentropy() implementation makes use of this library on AIX.

2 years agobuild: Annotate droppable functions for musl on next SOVERSION bump
Guillem Jover [Tue, 18 Apr 2023 01:59:17 +0000 (03:59 +0200)] 
build: Annotate droppable functions for musl on next SOVERSION bump

These are already provided by the musl libc, and can thus be dropped on
the next SOVERSION bump.

2 years agobuild: Conditionalize bsd_getopt() on macOS
Guillem Jover [Tue, 18 Apr 2023 01:58:24 +0000 (03:58 +0200)] 
build: Conditionalize bsd_getopt() on macOS

The system library provides a getopt() with BSD semantics.

2 years agoMove the version script comments before the symbols
Guillem Jover [Mon, 17 Apr 2023 22:47:12 +0000 (00:47 +0200)] 
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.

2 years agoPort getprogname() to AIX
Guillem Jover [Mon, 17 Apr 2023 22:44:49 +0000 (00:44 +0200)] 
Port getprogname() to AIX

Get the program name from the COMM field from the proc filesystem.

We could use instead the information from the psinfo binary file under
/proc, but that seems to have a shorter string limit.

2 years agoMake getprogname() porting mandatory
Guillem Jover [Mon, 17 Apr 2023 21:59:03 +0000 (23:59 +0200)] 
Make getprogname() porting mandatory

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.

2 years agotest: Do not use /dev/null as compiler output file
Guillem Jover [Mon, 17 Apr 2023 21:59:19 +0000 (23:59 +0200)] 
test: Do not use /dev/null as compiler output file

Some ld(1) implementations, such as the one on AIX, do not support using
/dev/null as the output filename for the compiled object.

Use an actual filename that we will then clean up.

2 years agobuild: Add generated *.sym files to .gitignore
Guillem Jover [Mon, 17 Apr 2023 22:49:09 +0000 (00:49 +0200)] 
build: Add generated *.sym files to .gitignore

2 years agobuild: On macOS do not build functions provided by the system
Guillem Jover [Tue, 4 Apr 2023 21:59:05 +0000 (23:59 +0200)] 
build: On macOS do not build functions provided by the system

We have never built before on macOS, so we can exclude all the functions
that are currently provided in the system.

Closes: #1
Closes: !3
2 years agobuild: Select whether to include funopen() in the build system
Guillem Jover [Thu, 6 Apr 2023 21:05:27 +0000 (23:05 +0200)] 
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.

2 years agobuild: Move Windows OS detection to the OS features section
Guillem Jover [Fri, 7 Apr 2023 21:43:55 +0000 (23:43 +0200)] 
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.

2 years agobuild: Remove __MUSL__ definition from configure
Guillem Jover [Fri, 7 Apr 2023 21:40:22 +0000 (23:40 +0200)] 
build: Remove __MUSL__ definition from configure

We stopped relying on this macro when we turned the funopen() cpp error
into a warning in commit e50896286cc5718898194edb73fa7262ad9a22db.

2 years agobuild: Add a new libbsd_strong_alias() macro and switch users to it
Guillem Jover [Sun, 2 Apr 2023 20:33:25 +0000 (22:33 +0200)] 
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.

2 years agobuild: Only emit link warnings for ELF objects
Guillem Jover [Sun, 2 Apr 2023 20:32:11 +0000 (22:32 +0200)] 
build: Only emit link warnings for ELF objects

2 years agobuild: Use an export symbols file if there is no version script support
Guillem Jover [Mon, 10 Apr 2023 22:24:13 +0000 (00:24 +0200)] 
build: Use an export symbols file if there is no version script support

We generate the symbol list from the version script to avoid repeating
ourselves and potentially getting the lists out-of-sync.

2 years agobuild: Add -no-undefined libtool flag
Guillem Jover [Tue, 11 Apr 2023 01:03:54 +0000 (03:03 +0200)] 
build: Add -no-undefined libtool flag

We have no need for undefined symbols, so we can let the shared
library build even on systems without support for undefined symbols.

2 years agobuild: Do not override the default DEPENDENCIES for libbsd
Guillem Jover [Tue, 11 Apr 2023 01:02:30 +0000 (03:02 +0200)] 
build: Do not override the default DEPENDENCIES for libbsd

Extend it instead via EXTRA_*_DEPENDENCIES, to make sure that we
preserve the builtin library dependencies generated from LIBADD.

2 years agoOnly use <stdio_ext.h> if present
Guillem Jover [Sat, 1 Apr 2023 10:46:49 +0000 (12:46 +0200)] 
Only use <stdio_ext.h> if present

2 years agoDefine _NSIG if it is not defined by the system
Guillem Jover [Sat, 1 Apr 2023 10:45:04 +0000 (12:45 +0200)] 
Define _NSIG if it is not defined by the system

At least on macOS this macro is not defined.

2 years agoDeclare environ if the system does not do so
Guillem Jover [Sat, 1 Apr 2023 10:41:42 +0000 (12:41 +0200)] 
Declare environ if the system does not do so

The environ variable is supposed to be defined by the code using it, but
on glibc-based systems it will get defined if we request it, by including
<unistd.h> and defining _GNU_SOURCE.

2 years agoUse lockf() when flock() is not available
Guillem Jover [Mon, 10 Apr 2023 21:10:40 +0000 (23:10 +0200)] 
Use lockf() when flock() is not available

On Solaris flock() is not available, and we should use instead lockf()
or fcntl().

2 years agotest: Use open_memstream() only if available
Guillem Jover [Mon, 10 Apr 2023 21:11:33 +0000 (23:11 +0200)] 
test: Use open_memstream() only if available

On Solaris this function is not yet available.

2 years agotest: Do not hardcode root:root user and group names
Guillem Jover [Mon, 10 Apr 2023 18:57:14 +0000 (20:57 +0200)] 
test: Do not hardcode root:root user and group names

On some systems the root group is named wheel, and there is no root
group.

2 years agotest: Fix closefrom() test on macOS
Guillem Jover [Sat, 1 Apr 2023 00:46:22 +0000 (02:46 +0200)] 
test: Fix closefrom() test on macOS

On macOS we do not close the file descriptors, and instead mark them all
as close-on-exec. So checking whether they are not valid does not work.

2 years agotest: Fix closefrom() test to handle open file descriptor limits
Guillem Jover [Sat, 1 Apr 2023 00:48:47 +0000 (02:48 +0200)] 
test: Fix closefrom() test to handle open file descriptor limits

If the system has configured a lower limit (either soft or hard) on the
number of open file descriptors, the test will fail. Make sure to check
whether we have exceeded that limit and adapt the max number of file
descriptors appropriately.

2 years agotest: Disable blank_stack_side_effects() on non-Hurd systems
Guillem Jover [Tue, 4 Apr 2023 22:01:42 +0000 (00:01 +0200)] 
test: Disable blank_stack_side_effects() on non-Hurd systems

This code was added to cope with Hurd specific behavior, but it is
causing flakiness on containers on some Linux systems. Only enable
it where it is currently needed to try to get stability back on CI
systems.

Closes: #14
2 years agobuild: Do not enable ASAN for musl CI pipelines
Guillem Jover [Wed, 29 Mar 2023 07:35:27 +0000 (09:35 +0200)] 
build: Do not enable ASAN for musl CI pipelines

musl-libc does not currently support ASAN, so enabling it makes
configure fail to detect libmd as it cannot link to it anymore.

2 years agoman: Add HISTORY section to arc4random(3bsd)
Guillem Jover [Wed, 29 Mar 2023 00:32:37 +0000 (02:32 +0200)] 
man: Add HISTORY section to arc4random(3bsd)

2 years agoman: Switch arc4random(3bsd) man page from OpenBSD to NetBSD
Guillem Jover [Wed, 29 Mar 2023 00:28:52 +0000 (02:28 +0200)] 
man: Switch arc4random(3bsd) man page from OpenBSD to NetBSD

This gets rid of the last BSD-4-clause licensed file in the project.

The man page will probably need to be adapted to the current
implementation, but that can be done piecemeal afterwards.

Closes: #7
2 years agodoc: Remove written-by attribution
Guillem Jover [Tue, 14 Mar 2023 00:58:40 +0000 (01:58 +0100)] 
doc: Remove written-by attribution

While attribution is important, it is not relevant when tracking the
copyright holders for the work. And in any case it still stays in the
relevant source file.

2 years agobuild: Add support for sanitizer compiler flags
Guillem Jover [Sat, 20 Feb 2021 21:23:40 +0000 (22:23 +0100)] 
build: Add support for sanitizer compiler flags

2 years agotest: Exempt blank_stack_side_effects() from sanitizer checks
Guillem Jover [Tue, 21 Mar 2023 03:11:03 +0000 (04:11 +0100)] 
test: Exempt blank_stack_side_effects() from sanitizer checks

This will mean we cannot use sanitizer support on the Hurd, for which
this function was added to fix the test. But the sanitizer suppression
function attribute is not having any effect, so this is better than
nothing.

2 years agotest: Import explicit_bzero() sanitizer support changes from OpenBSD
Guillem Jover [Tue, 21 Mar 2023 03:10:33 +0000 (04:10 +0100)] 
test: Import explicit_bzero() sanitizer support changes from OpenBSD

2 years agotest: Fix memory leaks in fpurge test
Guillem Jover [Tue, 14 Mar 2023 02:05:58 +0000 (03:05 +0100)] 
test: Fix memory leaks in fpurge test

Warned-by: gcc -fsanitize=leak
2 years agoman: Fix BSD and glibc versions
Guillem Jover [Fri, 3 Mar 2023 00:27:31 +0000 (01:27 +0100)] 
man: Fix BSD and glibc versions

The versions used in the BSD macros are unknown, so they emit warnings,
extend or reduce them to use the two digit form. Correct the glibc
version when closefrom(3) got introduced.

2 years agoman: Update STANDARDS and HISTORY sections
Guillem Jover [Sun, 19 Feb 2023 23:11:10 +0000 (00:11 +0100)] 
man: Update STANDARDS and HISTORY sections

Include BSD versions when functions were introduced. Add mention
whether these are BSD extensions.

2 years agoinclude: Adjust closefrom() per glibc adoption
Callum Farmer [Thu, 16 Feb 2023 21:26:05 +0000 (21:26 +0000)] 
include: Adjust closefrom() per glibc adoption

Added in glibc 2.34
https://sourceware.org/git/?p=glibc.git;a=commit;h=607449506f197cc9514408908f41f22537a47a8c

Signed-off-by: Guillem Jover <guillem@hadrons.org>
2 years agobuild: Switch to debian:latest Docker image
Guillem Jover [Fri, 17 Feb 2023 21:28:45 +0000 (22:28 +0100)] 
build: Switch to debian:latest Docker image

This should always point to the latest Debian stable images.

2 years agobuild: Fix version script linker support detection
Guillem Jover [Sun, 12 Feb 2023 22:55:09 +0000 (23:55 +0100)] 
build: Fix version script linker support detection

When the linker uses --no-undefined-version either specified by the user
or as the default behavior (such as with newer clang >= 16 releases),
a missing symbol definition will cause a linker error if that symbol is
listed in the version script.