Log

Author Commit Date CI Message
Guillem Jover a1730c10 2018-05-15T00:55:02 Add Windows support for getentropy() and arc4random() Import from OpenBSD.
Guillem Jover 6f68c930 2018-05-21T00:22:38 Switch strtonum() implementation from strtoll() to strtoi() Import from NetBSD.
Guillem Jover ef5faeb5 2018-05-20T19:20:33 Update few RCS keyword contents to match BSD originals This will slightly reduce the delta, and makes it easier to compare the sources.
Guillem Jover 21edbb4f 2018-05-21T00:31:15 Update fmtcheck() from NetBSD
Guillem Jover e3979d1a 2018-05-20T19:22:16 Update humanize_number() from FreeBSD Implements HN_IEC_PREFIXES.
Guillem Jover 2d7de186 2018-05-21T03:09:05 Update vis/unvis modules from NetBSD
Guillem Jover facbddb6 2018-05-20T19:18:18 Update pidfile module from FreeBSD Use EINVAL instead of EDOOFUS. Add a missing synopsis for pidfile_fileno() in the man page. Move the definition of struct pidfh from libutil.h into pidfile.c following upstream change.
Guillem Jover 3d88c999 2018-05-15T00:41:26 Update arc4random() headers from OpenBSD Split Linux support into its own header separate from the generic Unix to fix a Linux-specific issue with clone(). Reset rsp to NULL on failure.
Guillem Jover e13b1a33 2018-05-21T00:20:49 Import strtoi() and strtou() functions from NetBSD
Guillem Jover 3efad641 2018-05-21T01:56:33 Update readpassphrase() from OpenBSD
Guillem Jover e42381dc 2018-05-15T00:41:26 Update getentropy() code from OpenBSD Includes changes to handle the Linux syscall blocking when there is not enough entropy during boot, by switching it to non-blocking mode and falling back to the alternative implementations. Man page URL reference fixes. Build fixes for Mac OS X. Fixes: https://bugs.debian.org/898088
Guillem Jover a6f407ab 2018-05-21T01:34:17 Update heapsort() from OpenBSD
Guillem Jover 993828d8 2018-05-21T01:11:46 Add flopenat() function from FreeBSD
Guillem Jover 30b4d507 2018-05-21T03:00:47 Add __arraycount() macro from NetBSD
Baruch Siach f6ed7c27 2018-04-03T20:10:14 Fix build for openrisc with uClibc uClibc defines EM_OR1K instead of EM_OPENRISC for the OpenRISC ELF e_machine ID. Use EM_OR1K when EM_OPENRISC is not defined. This fixes the following build failure: In file included from nlist.c:44:0: nlist.c: In function ‘__elf_is_okay__’: local-elf.h:224:23: error: ‘EM_OPENRISC’ undeclared (first use in this function) #define ELF_TARG_MACH EM_OPENRISC ^ nlist.c:77:26: note: in expansion of macro ‘ELF_TARG_MACH’ if (ehdr->e_machine == ELF_TARG_MACH && ^ Signed-off-by: Guillem Jover <guillem@hadrons.org>
Guillem Jover 1f8a3f7b 2018-03-06T01:39:45 Fix function declaration protection for glibc already providing them On non-glibc based systems we cannot unconditionally use the __GLIBC_PREREQ macro as it gets expanded before evaluation. Instead, if it is undefined, define it to 0. We should also always declare these functions on non-glibc based systems. And on systems with a new enough glibc, which provides these functions, we should still provide the declarations if _GNU_SOURCE is *not* defined. Reported-by: Jörg Krause <joerg.krause@embedded.rocks>
Guillem Jover b20272f5 2018-03-06T01:42:52 Remove <features.h> inclusion from <bsd/libutil.h> This is a non-portable header, and we should not assume it is present. Let the first system header pull it in if needed.
Guillem Jover 11ec8f1e 2018-03-06T01:41:35 Handle systems missing <sys/cdefs.h> This is a non-portable header, and we cannot expect it to be provided by the system libc (e.g. musl). We just need and rely on declaration that we have defined ourselves in our own <bsd/sys/cdefs.h>. So we switch to only ever assume that. Fixes: https://bugs.freedesktop.org/105281
Guillem Jover 5ba8c5ba 2018-03-05T00:37:47 progname: Port to Windows Define the directory separator depending on the system targetted. Reported-by: Progyan Bhattacharya <progyanb@acm.org>
Guillem Jover 0093ca2b 2018-03-05T00:02:34 Handle SPARC V8+ on Sun Studio compiler
James Clarke 0b65d439 2018-03-04T23:44:52 Add support for ELF machine EM_SPARC32PLUS 32-bit SPARC on V8+ uses a different ELF machine type. Fixes: https://bugs.gentoo.org/634550 Signed-off-by: Guillem Jover <guillem@hadrons.org>
Guillem Jover 0b61c5ff 2018-01-13T16:20:35 Release libbsd 0.8.7
Jason Duerstock 9ceac74e 2017-12-03T16:50:07 test: Fix nlist(3) unit test on IA64 On IA64 this is only the case in the ELF binary, but it gets normalized when loaded at run-time. Fixes: https://bugs.debian.org/881611 Signed-off-by: Guillem Jover <guillem@hadrons.org>
Adam Lackorzynski 9afc7100 2017-12-03T16:46:19 Fix <sys/cdefs.h> for gcc with no __has_include or __has_include_next support Fixes: https://bugs.freedesktop.org/103396 Signed-off-by: Guillem Jover <guillem@hadrons.org>
Guillem Jover 22fbd623 2017-09-02T19:55:50 Handle several functions now being provided by glibc We mention that these are now superseded by the glibc implementations, make the headers cope with already declared functions on glibc-based systems, and document this in the man pages.
Guillem Jover b4f7c065 2017-08-05T13:42:56 man: Document on what other BSDs arc4random(3) is present
Guillem Jover bbf90ac3 2017-07-17T01:01:13 Release libbsd 0.8.6
Guillem Jover 2a8514d8 2017-07-17T00:57:07 Fix handling of non-contiguous argv + envp in setproctitle() The two arrays might not reference contiguous memory, and assuming they are does break at least now on GNU/Hurd, which contains an unmapped memory block between the memory used by the two arrays. Just check that each element is strictly after the previous one, so that we know there are no unmapped memory blocks inbetween.
Guillem Jover 3b2b7938 2017-06-25T01:51:30 test: Fix nlist() unit test on IA64 and PowerPC 64-bit ELFv1 At least on IA64 and PowerPC 64-bit ELFv1, the functions are stored in the .text sections but they are accessed through a function descriptor stored in a data section, for example for PowerPC 64-bit ELFv1 that section is called .opd. We should take this into account when checking the n_type for the functions we have requested information from nlist(). Rationale-by: James Clarke <jrtc27@jrtc27.com>
Guillem Jover 415e3cb2 2017-06-24T16:10:14 Release libbsd 0.8.5
Guillem Jover a4dd754c 2017-06-22T04:58:09 man: Ship and install libbsd(7) Fixes: https://bugs.freedesktop.org/101543
Guillem Jover 9532cb39 2017-06-23T05:59:35 man: Update man page sections in titles and references We have moved all man pages to section 3bsd, let's do the same for the page title, and in all the references for uniformity and to avoid confusions. Fixes: https://bugs.freedesktop.org/101545
James Cowgill b480b7a3 2017-06-19T21:38:40 Fix ELF definitions for MIPS in local-elf.h Add a check for _MIPS_SIM inside the __mips__ #elif to detect mips64el and use ELFCLASS64 in that case. Note that we can't use defined(__mips64) here because that is also defined when the n32 ABI is in use, which uses ELFCLASS32. Fixes: https://bugs.debian.org/865091 Signed-off-by: Guillem Jover <guillem@hadrons.org>
James Cowgill 4cc20e23 2017-06-19T21:37:14 Fix ELF definitions for PowerPC in local-elf.h * ppc64el defines both __powerpc__ and __powerpc64__ but since the __powerpc64__ #elif is below the __powerpc__ one, it will never be hit. * Both assumed that powerpc* was big-endian. Fixes: https://bugs.debian.org/865091 Signed-off-by: Guillem Jover <guillem@hadrons.org>
Guillem Jover c4e58c09 2017-06-19T21:41:13 test: Remove unused variable in nlist() unit test
Guillem Jover 736e12e8 2017-06-19T21:32:01 test: Handle libtool executable names in getprogname() unit test Sometimes libtool will prefix the test programs with "lt-", we should handle these and strip the prefix. Fixes: https://bugs.debian.org/865090
Guillem Jover 8bff4b1f 2017-06-19T03:16:56 Release libbsd 0.8.4
Guillem Jover 0071b979 2017-06-05T05:43:26 Import <sys/time.h> for some of its macros Fixes: https://bugs.freedesktop.org/94320
Guillem Jover cdbb9d05 2017-06-18T20:30:40 test: Add new strnstr() unit test
Guillem Jover 0365d0ef 2017-06-18T20:30:19 test: Add new setprogname() and getprogname() unit test
Guillem Jover 10b13285 2017-06-18T20:29:52 test: Add new setmode() and getmode() unit test
Guillem Jover 922eff5c 2017-06-14T01:52:12 test: Add new nlist() unit test
Guillem Jover 8e8834d8 2017-06-14T02:53:35 Remove RCSID tags These are obsolete markers, and in some cases they repeat the information already present in the comment header.
Guillem Jover 79386192 2017-06-14T02:45:13 Update .gitignore for headers generator
Guillem Jover ec5d9a68 2017-06-14T02:44:37 Namespace header inclusion protection macros Use LIBBSD_, and remove trailing underscores.
Guillem Jover 47013bc9 2017-06-14T01:49:25 Fix broken mmap() usage in nlist() by switching to pread() The offset is not page aligned, which makes mmap() return EINVAL on Linux. Switch to use pread() which handles unaligned offset and non-page sized reads, and because we are already loading parts of the executable by read() calls, so there's not much point in using mmap() anyway.
Guillem Jover e8d340de 2017-06-05T05:30:27 Remove a.out support from nlist() Some libc libraries do not have an <a.out.h> header. And a.out as an executable format is very much obsolete on pretty much all currently supported systems, even if they might still support loading such objects. Remove the a.out support to increase portability.
Igor Gnatenko 7aede6a9 2016-06-27T09:21:43 Make strlcpy()/strlcat() slightly easier to read Backport new changes from OpenBSD. [guillem@hadrons.org: - Update copyright years in COPYING. ] References: https://svnweb.freebsd.org/base?view=revision&revision=281135 Signed-off-by: Igor Gnatenko <i.gnatenko.brain@gmail.com> Signed-off-by: Guillem Jover <guillem@hadrons.org>
Guillem Jover ab5db68b 2017-06-19T03:02:32 build: Add missing \ at end of line Fixes: commit 934b7a0ccbdc60313102f153eadc2f46853a505b
Guillem Jover 5a46e486 2017-06-18T20:30:51 Update TODO
Guillem Jover 7a75f550 2017-06-06T04:56:49 Update TODO
Guillem Jover f1dd5f2e 2017-06-09T05:13:32 test: Add unit test for strlcpy() and strlcat()
Guillem Jover c8a1b08b 2017-06-09T05:14:24 build: Match any glibc and musl ABIs on the host_os AS_CASE Reported-by: Helmut Grohne <helmut@subdivi.de>
Guillem Jover 4fec871c 2017-06-09T04:52:45 build: Quote the arguments to AC_CONDITIONAL
Guillem Jover 3945693e 2017-06-09T04:52:45 build: Move AC_TYPE_UID_T close to the other AC_TYPE_* checks
Guillem Jover c253365d 2017-06-09T04:52:45 build: Move configure.ac comment into actual AC_CASE
Guillem Jover 8248e5f7 2017-06-07T23:09:40 build: Use src/strlcpy.c in AC_CONFIG_SRCDIR The src/fgetln.c file contains a function considered obsolete, use one that is not.
Guillem Jover c74ca099 2017-06-07T22:46:07 man: Use .In intead of .Fd macros for includes
Guillem Jover ba9e2a5a 2017-06-05T06:33:47 man: Add new libbsd(7) library overview man page
Guillem Jover 6a5a5158 2017-06-07T05:00:34 man: Add missing man pages This adds man pages for byteorder(3), errc(3) and fpurge(3), including all their aliases.
Guillem Jover 934b7a0c 2017-06-05T06:32:36 man: Add missing aliases
Guillem Jover f20e6972 2017-06-05T06:43:22 man: Move all man pages to section 3bsd This should guarantee that even if the system provides or will provide native implementations of these functions, we will not have file conflicts.
Guillem Jover 07c76b66 2017-06-05T06:17:27 Do not use legacy BSD u_* types Some systems do not have these types available, and they are simply convenience aliases. Instead use the expanded versions which are more portable. Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=101192
Guillem Jover e4475738 2017-01-20T02:20:12 Try <linux/a.out.h> if <a.out.h> is not present At least musl ships the former but not the latter.
Guillem Jover d6c35f61 2017-01-10T04:33:15 Do not provide funopen() on musl Fixes: https://bugs.debian.org/818246
Guillem Jover db7470b0 2017-01-10T04:27:25 Gracefully handle lack of system <sys/cdefs.h> This is the case on musl. Fixes: https://bugs.debian.org/810589
Guillem Jover 368af99f 2016-08-28T17:13:20 Fix the __progname check to avoid the optimizer discarding the symbol Because we were assigning to another unused variable, when building the check with optimizations enabled, which is the default when using gcc as the compiler, the variable was being discarded. Instead pass it to printf() so that it cannot do so.
Guillem Jover 337e6202 2017-01-10T04:24:35 Support GCC deprecated attribute for GCC older than 4.5 Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=99190 Based-on-patch-by: Eric Smith <brouhaha@fedoraproject.org>
Guillem Jover 088f147e 2017-02-08T01:49:48 Add support for RISC-V
Helmut Grohne b2b1020d 2017-01-10T03:47:52 Add support for TileGX Fixes: https://bugs.debian.org/847560 Signed-off-by: Guillem Jover <guillem@hadrons.org>
Guillem Jover 9bed430e 2016-04-23T10:13:23 Release libbsd 0.8.3
Szabolcs Nagy cbfe0ebc 2016-03-27T12:37:09 Add missing <fcntl.h> includes These are required due to the O_* macro usage, but have passed undetected on glibc-based systems due to implicit inclusions. Signed-off-by: Guillem Jover <guillem@hadrons.org>
Guillem Jover f3b566bd 2016-03-27T12:31:58 test: Add a unit test for md5
Guillem Jover e86c1b5f 2016-02-14T09:00:57 man: Fix ungrammatical construct Warned-by: lintian
Guillem Jover b7ce33cf 2016-02-12T22:56:09 build: Support clock_gettime() provided in librt In older glibc versions (< 2.17) clock_gettime() is in librt. Add a check for this to avoid build breakage for programs/libraries that use libbsd on such systems. Based-on-patch-by: Gustavo Zacarias <gustavo@zacarias.com.ar> Signed-off-by: Guillem Jover <guillem@hadrons.org>
Guillem Jover ed84bec5 2016-02-10T10:38:51 Switch URLs from http or git to https
Guillem Jover cbe30577 2016-02-07T02:53:28 Fix file descriptor leak in HASHFileChunk helper This leak only happens on error conditions, so it's not too bad. Warned-by: coverity
Guillem Jover 5a32ea0a 2016-02-07T02:47:22 Fix unportable sizeof() usage We are calculating the size of the array, and need to pass the size of each element, not the size of a pointer to an element. Although this happens to be the same in many cases, this is not a portable assumption. Warned-by: coverity
Guillem Jover 2fb148a2 2016-01-27T15:25:23 Release libbsd 0.8.2
Hanno Boeck c8f0723d 2016-01-27T15:10:11 Fix heap buffer overflow in fgetwln() In the function fgetwln() there's a 4 byte heap overflow. There is a while loop that has this check to see whether there's still enough space in the buffer: if (!fb->len || wused > fb->len) { If this is true more memory gets allocated. However this test won't be true if wused == fb->len, but at that point wused already points out of the buffer. Some lines later there's a write to the buffer: fb->wbuf[wused++] = wc; This bug was found with the help of address sanitizer. Warned-by: ASAN Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=93881 Signed-off-by: Guillem Jover <guillem@hadrons.org>
Hanno Boeck 008316aa 2016-01-27T15:06:50 test: Add missing <sys/stat.h> include The test in test/strmode.c can fail to compile depending on the optimization flags used. The constants that are used in this file (S_IFREG etc.) come from the <sys/stat.h> include file. It seems gcc ignores this error if one compiles with "-O2" (default), but if one uses no optimization it fails. Add the missing include and it works all the time. Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=93880 Signed-off-by: Guillem Jover <guillem@hadrons.org>
Guillem Jover e4ab2c62 2016-01-11T02:21:15 test: Fix success return code for arc4random unit test
Lukas Fleischer bf5573f8 2016-01-07T17:26:12 test: Fix race condition in headers-*.sh When running tests in parallel (e.g. using `make -j4 check`), the header tests currently fail due to headers-overlay.sh and headers-system.sh both generating headers-gen.c simultaneously, resulting in garbled output. Fix this by using separate C files for the tests. Signed-off-by: Lukas Fleischer <lfleischer@lfos.de> Signed-off-by: Guillem Jover <guillem@hadrons.org>
Guillem Jover 229f8579 2015-12-14T03:39:48 Release libbsd 0.8.1
Guillem Jover 7a756875 2015-12-14T03:03:57 Add support for GNU/Hurd to getentropy() Reuse the getentropy code for Linux on the Hurd, which has fallbacks for when the better interfaces are not present. And remove all the code that is not supported currently on the Hurd. Ideally the Hurd should get an equivalent interfaces that does not suffer from the same problems as /dev/urandom.
Guillem Jover f84004ba 2015-12-12T14:26:50 test: Add new unit tests for individual headers usage
Guillem Jover cdf998a0 2015-12-14T00:44:47 Turn <bsd/bsd.h> inert when using LIBBSD_OVERLAY Also print a warning stating this fact.
Guillem Jover 2c77ad59 2015-12-14T00:37:34 Add missing include to <md5.h> The header was not self-contained, it was missing definitions for some types included in <sys/types.h>.
Guillem Jover 48ac79b1 2015-12-12T14:27:12 Use the non-overlayed libbsd headers when we need our own definitions
Guillem Jover 290a1ce8 2015-12-07T02:40:46 Switch COPYING to Debian copyright machine readable format 1.0
Guillem Jover 6bcb1312 2015-12-07T02:45:52 Relicense my contribution to BSD-2-clause This avoids having two licenses on the same file.
Guillem Jover da137a09 2015-12-07T01:53:49 Add missing copyright and license headers
Guillem Jover d2f59a23 2015-12-02T04:00:58 Fix getentropy implementation to use the correct system hooks Include getentropy_<SYSTEM>.c instead of arc4random_<SYSTEM>.c.
Guillem Jover 01b77f0d 2015-12-02T03:32:13 Add support for GNU/kFreeBSD for closefrom() and getentropy()
Guillem Jover 75729394 2015-12-02T03:08:17 Unify most arc4random Unix hooks into a single file The Unix hook should work for most Unix-like systems, move glibc specific code there and a FreeBSd specific comment, and remove the rest. Also change the code to always fallback to use the generic Unix code. This should cover GNU/Hurd and GNU/kFreeBSD among others.
Guillem Jover 8493c7f2 2015-12-01T03:39:10 Use local SHA512 header Actually use the local private SHA512 header instead of relying on the OpenSSL one for no good reason. Add definition for expected macro SHA512_DIGEST_LENGTH.
Guillem Jover 2b030da0 2015-11-30T03:59:42 Release libbsd 0.8.0
Guillem Jover 330e2111 2015-11-30T03:53:21 Update license and copyright information
Guillem Jover 874a0e51 2015-09-23T19:39:47 Update arc4random module from OpenBSD and LibreSSL Rework arc4random_stir() and arc4random_addrandom() code over the new internal API, and documentation in the man page. Adapt the code to the local build system. Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=85827
Guillem Jover 9a9a8b2d 2015-09-23T19:39:47 Add private getentropy module from OpenBSD and LibreSSL Adapt the code to the local build system.