Log

Author Commit Date CI Message
Guillem Jover b6d6da4c 2024-02-20T04:40:32 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.
Guillem Jover f8cb9d8b 2024-02-20T03:57:37 build: Remove space before shell redirection This makes it more clear what the redirection applies to.
Guillem Jover 154624ab 2024-02-18T20:40:24 build: Add support for silent rules for the libbsd.map generation The new rule was introduced w/o silent rule support. Fixes: commit 19e06407eb365a2bedc9bdd29a83c1e1803e3f92
Guillem Jover 9fab225f 2024-02-17T05:25:01 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 461f10ac 2024-02-17T03:07:58 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>
Guillem Jover f0501609 2024-02-14T03:39:16 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.
Guillem Jover 19e06407 2024-02-11T19:35:05 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 10920c30 2024-02-12T00:06:56 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 97b0fe84 2024-01-08T23:57:45 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.
Guillem Jover e87ae3be 2024-01-08T23:40:31 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 9275d134 2024-01-08T23:39:19 man: Add closefrom(), strlcpy() and strlcat() as superseded functions These were missing from the list of functions provided by some libc implementation.
Guillem Jover 304a1f83 2024-01-08T23:37:43 doc: Use macOS to refer to the operating system This is the correct spelling, instead of capitalizing it.
Guillem Jover edddd806 2024-01-08T02:16:12 Release libbsd 0.11.8
Guillem Jover dd0bdb58 2024-01-08T01:58:54 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
Guillem Jover 0813f378 2023-10-28T00:52:31 build: Check out-of-tree builds in CI Make sure the out-of-tree builds do not regress.
Guillem Jover df116b55 2024-01-07T17:43:12 Adjust strlcpy() and strlcat() per glibc adoption These functions were added in glibc 2.38, in anticipation of POSIX adopting them too. Closes: #26
Guillem Jover ecb44e16 2023-11-14T19:15:11 Do not add a pointer to the NULL constant Warned-by: cppcheck (nullPointerArithmetic)
Guillem Jover 459b7f7d 2023-11-14T19:09:25 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)
Guillem Jover a44f885c 2023-11-14T19:08:15 test: Fix short-lived memory leak Warned-by: cppcheck
Guillem Jover 3f5ca0aa 2023-10-28T00:47:26 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.
Guillem Jover 9d3e59a0 2023-10-10T01:53:32 man: Use VARIANTS instead of ALTERNATIVES in libbsd(7) Using alternatives seems confusing in this context.
Guillem Jover f02562d6 2023-10-10T01:52:37 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.
Guillem Jover b7367c9c 2023-09-05T03:02:44 build: Add missing dash to macro title bar
Guillem Jover 6777eb62 2023-07-27T13:57:51 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
Guillem Jover d4e0cdc9 2023-07-27T13:39:00 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.
Guillem Jover f41d6c12 2023-05-26T23:55:40 build: Refactor GNU .init_array support check into a new m4 function
Guillem Jover 30b48ed9 2023-05-26T23:50:10 build: Refactor linker script detection into a new m4 function
Guillem Jover d0d8d019 2023-07-27T13:51:36 build: Do not provide prototypes for arc4random() on Solaris These functions are provided by the system.
Guillem Jover cf61ebb8 2023-04-22T20:47:20 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
Guillem Jover 73b25a8f 2023-04-23T02:04:47 build: Sort entries alphabetically
Guillem Jover 5434ba16 2023-04-23T02:05:04 build: Conditionalize wcslcpy() and wcslcat() functions on macOS These functions are provided by the system libc.
Guillem Jover dc1bd1a2 2023-04-23T02:00:10 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.
Guillem Jover edc746ea 2023-04-22T22:47:10 build: Conditionalize getprogname()/setprogname on macOS These functions are provided by the system libc, so there is no need for us to provide them.
Guillem Jover 8f998d1d 2023-04-22T20:23:08 progname: Include <procinfo.h> if available We need this header on AIX. Missed transplanting the code from the AIX porting system. Fixes: commit 9fa06763a1afe0946a3a20e5bbdba72885cbade5
Guillem Jover d08163b4 2023-04-18T03:56:16 build: Check whether we need libperfstat on AIX The getentropy() implementation makes use of this library on AIX.
Guillem Jover 1186cf88 2023-04-18T03:59:17 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.
Guillem Jover 6385ccc9 2023-04-18T03:58:24 build: Conditionalize bsd_getopt() on macOS The system library provides a getopt() with BSD semantics.
Guillem Jover c1206817 2023-04-18T00:47:12 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.
Guillem Jover 9fa06763 2023-04-18T00:44:49 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.
Guillem Jover 92337b15 2023-04-17T23:59:03 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.
Guillem Jover 90b7f3ae 2023-04-17T23:59:19 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.
Guillem Jover 426bf452 2023-04-18T00:49:09 build: Add generated *.sym files to .gitignore
Guillem Jover 21d12b02 2023-04-04T23:59:05 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
Guillem Jover bc65806c 2023-04-06T23:05:27 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.
Guillem Jover 8b7a4d9d 2023-04-07T23:43:55 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.
Guillem Jover ccbfd1c2 2023-04-07T23:40:22 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.
Guillem Jover e0976d7e 2023-04-02T22:33:25 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.
Guillem Jover 49c7dd1c 2023-04-02T22:32:11 build: Only emit link warnings for ELF objects
Guillem Jover 8622767a 2023-04-11T00:24:13 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.
Guillem Jover 8f610364 2023-04-11T03:03:54 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.
Guillem Jover ae7942ba 2023-04-11T03:02:30 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.
Guillem Jover a5faf170 2023-04-01T12:46:49 Only use <stdio_ext.h> if present
Guillem Jover 06e8a1b2 2023-04-01T12:45:04 Define _NSIG if it is not defined by the system At least on macOS this macro is not defined.
Guillem Jover 44824aca 2023-04-01T12:41:42 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.
Guillem Jover 1fb6c3f4 2023-04-10T23:10:40 Use lockf() when flock() is not available On Solaris flock() is not available, and we should use instead lockf() or fcntl().
Guillem Jover fe16f386 2023-04-10T23:11:33 test: Use open_memstream() only if available On Solaris this function is not yet available.
Guillem Jover 7c652a94 2023-04-10T20:57:14 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.
Guillem Jover ed2eb31d 2023-04-01T02:46:22 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.
Guillem Jover 0f8bcdfd 2023-04-01T02:48:47 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.
Guillem Jover 07192b31 2023-04-05T00:01:42 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
Guillem Jover ca3db5e1 2023-03-29T09:35:27 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.
Guillem Jover ff46386f 2023-03-29T02:32:37 man: Add HISTORY section to arc4random(3bsd)
Guillem Jover 4c6da577 2023-03-29T02:28:52 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
Guillem Jover 830dd88a 2023-03-14T01:58:40 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.
Guillem Jover 257800a0 2021-02-20T22:23:40 build: Add support for sanitizer compiler flags
Guillem Jover 536a7d42 2023-03-21T04:11:03 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.
Guillem Jover 7ed5de01 2023-03-21T04:10:33 test: Import explicit_bzero() sanitizer support changes from OpenBSD
Guillem Jover 05a802a2 2023-03-14T03:05:58 test: Fix memory leaks in fpurge test Warned-by: gcc -fsanitize=leak
Guillem Jover 5962e03c 2023-03-03T01:27:31 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.
Guillem Jover 59a21c7f 2023-02-20T00:11:10 man: Update STANDARDS and HISTORY sections Include BSD versions when functions were introduced. Add mention whether these are BSD extensions.
Callum Farmer 7b4ebd65 2023-02-16T21:26:05 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>
Guillem Jover 0dfbe769 2023-02-17T22:28:45 build: Switch to debian:latest Docker image This should always point to the latest Debian stable images.
Guillem Jover dec783dc 2023-02-12T23:55:09 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.
Guillem Jover fe21244b 2022-12-20T22:47:02 include: Use __has_builtin to detect __builtin_offsetof support The __has_builtin operator is more specific and is supported by GCC and Clang, while __is_identifier() is less specific and only supported by Clang, so we should prefer the former whenever it is available, and only fallback to use the latter when the former is missing and the latter.
Khem Raj ec88b7bb 2022-12-15T09:02:22 funopen: Replace off64_t with off_t in funopen_seek() AC_SYS_LARGEFILE in configure.ac is setting needed defines to make 64bit off_t on relevant platforms. Fixes build on musl: | src/funopen.c:68:28: error: unknown type name 'off64_t'; did you mean 'off_t'? | funopen_seek(void *cookie, off64_t *offset, int whence) | ^~~~~~~ | off_t Closes: !24 Signed-off-by: Khem Raj <raj.khem@gmail.com> Signed-off-by: Guillem Jover <guillem@hadrons.org>
Guilherme Janczak 23377191 2022-12-07T04:06:37 man: Prune unneeded <sys/types.h> include in setproctitle(3) FreeBSD first declared the function in unistd.h in 2000: https://cgit.freebsd.org/src/commit/include/unistd.h?id=9feac5c21886 No other #include line was needed to use the function, but the man page unnecessarily instructed users to include sys/types.h until 2022-11-29: https://cgit.freebsd.org/src/commit/?id=5b6f0a5012e9bc37dcb32b57b41e2443a46da620 libbsd first declared the function in unistd.h in 2010 with commit 3fed78e5b08f78256e533788b4bcd6502b0949d7 and inherited the bug from FreeBSD's man page. No need to do anything for backwards compat. Signed-off-by: Guillem Jover <guillem@hadrons.org>
Florian Weimer 5dea9da3 2022-12-13T03:37:06 build: Improve C99 compatibility of __progname configure check The check uses printf, so it needs to include <stdio.h> for compilers which do not support implicit function declarations. (They were removed from C99.) Closes: !23 Signed-off-by: Guillem Jover <guillem@hadrons.org>
Guillem Jover b9bf42dd 2022-12-13T03:35:05 build: Enable -Wall for automake This will make sure to warn about bogus or deprecated constructs.
Guillem Jover e57c0787 2022-12-13T03:34:37 build: Add missing AM_PROG_AR macro call to configure.ac Warned-by: autoreconf
Guillem Jover 80f1927d 2022-12-13T03:31:38 build: Fix configure.ac indentation Use the same style as the newly added code, which should make the code more readable, and produce more conforming C output.
Guillem Jover b7a8bc22 2022-12-13T03:10:28 build: Require automake 1.11 This is a rather old release (from 2009), that provides AM_SILENT_RULES.
Guillem Jover e5089628 2022-11-23T23:31:54 build: Do not require funopen() to be ported This function cannot be easily and (more importantly) correctly ported without cooperation from the libc stdio layer. We already document that users should be prepared to have the function not available on some platforms and that they should ideally switch their code to other more portable and better interfaces. Instead of making the build fail, and requiring porters to add exceptions for something that most probably cannot be ported correctly anyway, simply print a warning and let it build. This will not be a regression because on those systems libbsd would have never been built before. Prompted-by: Jens Finkhaeuser <jens@finkhaeuser.de>
Guillem Jover 00b538ff 2022-11-23T23:28:34 build: Terminate lists in variables with «# EOL» This means we can add a trailing «\» to every element, so that they can be removed without requiring modification of other lines, and can be easily sorted. Replace the old usage of $(nil) which could possibly end up with junk added if such variable is ever defined, in the environment.
Guillem Jover 5cfa39e5 2022-11-23T23:42:49 build: Use «yes» instead of «true» for AC_CHECK_FUNCS cache value This autoconf macro sets the ac_cv_func_ cached variable to «yes» not «true» so we were checking for an impossible condition.
Guillem Jover 084911ce 2022-10-06T04:07:52 Release libbsd 0.11.7
Guillem Jover 3538d38f 2022-10-06T03:59:33 man: Discourage using the library in non-overlay mode This makes code using it non-portable, and requires the namespeced headers from libbsd, instead of any generic system headers. It also requires more code changes than the overlay mode.
Guillem Jover 03fccd15 2022-10-05T12:08:31 include: Adjust reallocarray() per glibc adoption On glibc 2.29 reallocarray() was moved to _DEFAULT_SOURCE. Closes: !20 Based-on-patch-by: Callum Farmer <gmbr3@opensuse.org> Signed-off-by: Guillem Jover <guillem@hadrons.org>
Callum Farmer 6b6e686b 2022-10-05T12:08:31 include: Adjust arc4random() per glibc adoption Some arc4random functions were added in glibc 2.36. Signed-off-by: Callum Farmer <gmbr3@opensuse.org> Signed-off-by: Guillem Jover <guillem@hadrons.org>
Callum Farmer da1f45ac 2022-10-03T16:09:18 include: explicit_bzero() requires _DEFAULT_SOURCE Signed-off-by: Callum Farmer <gmbr3@opensuse.org> Signed-off-by: Guillem Jover <guillem@hadrons.org>
Guillem Jover 2f9eddc2 2022-10-05T02:05:46 include: Simplify glibc version dependent macro handling We test once whether __GLIBC__ is not defined, so we do not need to test whether it is on the OR branch afterwards. We decouple the glibc version restriction check from the _*_SOURCE variable, as that contains an implicit opposite version check.
Guillem Jover 28298ac0 2022-10-05T01:35:08 doc: Switch references from pkg-config to pkgconf The former used to be the reference implementation, but it has been stagnant to the point of not showing much signs of life. Switch to the currently active and more complete implementation for references.
Guillem Jover ef981f93 2022-10-04T04:28:05 doc: Add missing empty line to separate README sections
Guillem Jover 6928d789 2022-10-04T04:27:44 doc: Refer to the main git repository as primary
Guillem Jover d5865759 2022-08-25T00:52:43 test: Fix explicit_bzero() test on the Hurd On the Hurd a small read(3) might end up (indirectly) copying the data on the stack, which we will end up finding even when we have cleared the buffer. To avoid these side effects, we add a new function, that we force not to be inlined, so that we can reuse the same stack space, that will blank any possible stack side effects. This should be portable regardless of stack growing up or down. Diagnosis-by: Samuel Thibault <sthibault@debian.org>
Guillem Jover be327c6e 2022-08-24T01:58:58 fgetwln: Add comment about lack of getwline(3) for recommendation Ideally we'd recommend getwline(3), but unfortunately even though it was part of the ISO/IEC TR 24731-2:2010 draft, it did not make it into C11 and is not widely implemented.
Guillem Jover a14612d9 2022-08-23T23:49:34 setmode: Dot not use saveset after free While we are only doing a pointer difference and not dereferencing it, it's easier and more correct to do the pointer difference before passing it to reallocarray(). Warned-by: gcc
Guillem Jover f4baceb8 2022-08-03T03:05:52 man: Rewrite gerprogname(3bsd) from scratch This gets rid of one of the last man pages with a BSD-4-clause license.
Guillem Jover f35c5458 2022-08-03T02:21:16 man: Lowercase man page title While using fully uppercase man page titles has been the usual convention for a very long time, it is rather ugly and something that some other projects are switching away from.
Guillem Jover b466b14a 2022-08-03T01:23:09 man: Document that some arc4random(3) functions are now in glibc 2.36
Guillem Jover 1f6a48b2 2022-08-03T02:03:05 Sync arc4random(3) implementation from OpenBSD Closes: #12