libbsd: Branch 'master' - 10 commits
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Sun Feb 28 04:31:23 UTC 2021
.gitignore | 2 ++
.gitlab-ci.yml | 18 ++++++++++++++----
man/libbsd.7 | 12 ++++++------
src/closefrom.c | 2 +-
src/fgetln.c | 2 +-
src/fgetwln.c | 2 +-
src/getentropy_linux.c | 6 +++---
src/local-link.h | 2 +-
src/md5.c | 19 +++++++++++++++++++
src/nlist.c | 1 -
test/bzero.c | 2 +-
test/closefrom.c | 2 +-
test/endian.c | 2 +-
test/fpurge.c | 2 +-
test/funopen.c | 8 ++++----
test/md5.c | 4 ++--
test/overlay.c | 2 +-
17 files changed, 59 insertions(+), 29 deletions(-)
New commits:
commit 8f59221c4f0383153a7c7b499fbd1344cd9ad0f1
Author: Guillem Jover <guillem at hadrons.org>
Date: Fri Feb 19 06:51:18 2021 +0100
nlist: Remove repeated shadowing variable declaration
Warned-by: gcc
diff --git a/src/nlist.c b/src/nlist.c
index d22fa19..8012d5a 100644
--- a/src/nlist.c
+++ b/src/nlist.c
@@ -239,7 +239,6 @@ __fdnlist(int fd, struct nlist *list)
for (s = sbuf; cc > 0 && nent > 0; ++s, cc -= sizeof(*s)) {
char *name;
Elf_Word size;
- struct nlist *p;
name = strtab + s->st_name;
if (name[0] == '\0')
commit 72a82ee262795c9162e712885381a111fcf988bc
Author: Guillem Jover <guillem at hadrons.org>
Date: Sat Feb 20 22:22:54 2021 +0100
getentropy: Fix function cast for getauxval()
Warned-by: gcc
diff --git a/src/getentropy_linux.c b/src/getentropy_linux.c
index 25c986e..9cb3368 100644
--- a/src/getentropy_linux.c
+++ b/src/getentropy_linux.c
@@ -520,17 +520,17 @@ getentropy_fallback(void *buf, size_t len)
#ifdef HAVE_GETAUXVAL
#ifdef AT_RANDOM
/* Not as random as you think but we take what we are given */
- p = (char *) getauxval(AT_RANDOM);
+ p = (char *) ((intptr_t) getauxval(AT_RANDOM));
if (p)
HR(p, 16);
#endif
#ifdef AT_SYSINFO_EHDR
- p = (char *) getauxval(AT_SYSINFO_EHDR);
+ p = (char *) ((intptr_t) getauxval(AT_SYSINFO_EHDR));
if (p)
HR(p, pgs);
#endif
#ifdef AT_BASE
- p = (char *) getauxval(AT_BASE);
+ p = (char *) ((intptr_t) getauxval(AT_BASE));
if (p)
HD(p);
#endif
commit 3c305f2873580322823af53d9b9202b8ce658c32
Author: Guillem Jover <guillem at hadrons.org>
Date: Fri Feb 19 06:49:53 2021 +0100
test: Add proper prototypes for main() function
Warned-by: gcc
diff --git a/test/bzero.c b/test/bzero.c
index 227b163..6c4ec30 100644
--- a/test/bzero.c
+++ b/test/bzero.c
@@ -28,7 +28,7 @@
#include <string.h>
int
-main()
+main(int argc, char *argv[])
{
unsigned char array[40];
size_t i;
diff --git a/test/closefrom.c b/test/closefrom.c
index b5e7e92..160e6b1 100644
--- a/test/closefrom.c
+++ b/test/closefrom.c
@@ -31,7 +31,7 @@
#include <stdio.h>
int
-main()
+main(int argc, char *argv[])
{
int i;
int fd;
diff --git a/test/endian.c b/test/endian.c
index 349675f..06e5fcc 100644
--- a/test/endian.c
+++ b/test/endian.c
@@ -30,7 +30,7 @@
#include <string.h>
int
-main()
+main(int argc, char *argv[])
{
unsigned char decstream[] = {
0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77,
diff --git a/test/fpurge.c b/test/fpurge.c
index 03f107f..a99cff7 100644
--- a/test/fpurge.c
+++ b/test/fpurge.c
@@ -27,7 +27,7 @@
#include <stdio.h>
int
-main()
+main(int argc, char *argv[])
{
static FILE fp_bad;
FILE *fp;
diff --git a/test/md5.c b/test/md5.c
index bc2ed7d..b1b4af5 100644
--- a/test/md5.c
+++ b/test/md5.c
@@ -37,7 +37,7 @@ test_md5(const char *digest, const char *string)
}
int
-main()
+main(int argc, char *argv[])
{
test_md5("d41d8cd98f00b204e9800998ecf8427e", "");
test_md5("900150983cd24fb0d6963f7d28e17f72", "abc");
diff --git a/test/overlay.c b/test/overlay.c
index 0ec6d7c..d82f14e 100644
--- a/test/overlay.c
+++ b/test/overlay.c
@@ -45,7 +45,7 @@
#include <unistd.h>
int
-main()
+main(int argc, char *argv[])
{
/* Test that we do not get partial definitions. */
fflush(stdout);
commit 25278891d8b0c5af378ff548881cd3558426ba3d
Author: Guillem Jover <guillem at hadrons.org>
Date: Fri Feb 19 06:49:24 2021 +0100
Mark local functions as static
Warned-by: gcc
diff --git a/src/closefrom.c b/src/closefrom.c
index 087ccad..2df5d03 100644
--- a/src/closefrom.c
+++ b/src/closefrom.c
@@ -79,7 +79,7 @@ sys_close_range(unsigned int fd, unsigned int max_fd, unsigned int flags)
* Close all file descriptors greater than or equal to lowfd.
* This is the expensive (fallback) method.
*/
-void
+static void
closefrom_fallback(int lowfd)
{
long fd, maxfd;
diff --git a/test/funopen.c b/test/funopen.c
index aae558c..2b34f7e 100644
--- a/test/funopen.c
+++ b/test/funopen.c
@@ -37,7 +37,7 @@ struct test_cookie {
int index;
};
-int
+static int
test_readfn(void *cookie, char *buf, int size)
{
struct test_cookie *tc = cookie;
@@ -56,7 +56,7 @@ test_readfn(void *cookie, char *buf, int size)
return size;
}
-int
+static int
test_writefn(void *cookie, const char *buf, int size)
{
struct test_cookie *tc = cookie;
@@ -75,7 +75,7 @@ test_writefn(void *cookie, const char *buf, int size)
return size;
}
-off_t
+static off_t
test_seekfn(void *cookie, off_t offset, int whence)
{
struct test_cookie *tc = cookie;
@@ -95,7 +95,7 @@ test_seekfn(void *cookie, off_t offset, int whence)
return tc->index;
}
-int
+static int
test_closefn(void *cookie)
{
struct test_cookie *tc = cookie;
diff --git a/test/md5.c b/test/md5.c
index d421ab8..bc2ed7d 100644
--- a/test/md5.c
+++ b/test/md5.c
@@ -28,7 +28,7 @@
#include <md5.h>
#include <string.h>
-void
+static void
test_md5(const char *digest, const char *string)
{
char result[MD5_DIGEST_STRING_LENGTH];
commit e35d9141dcff06931287e392706f70c92c239e2e
Author: Guillem Jover <guillem at hadrons.org>
Date: Thu Feb 11 04:41:46 2021 +0100
Add link-time warnings to MD5 wrapper functions
Let's get the word out that these functions are deprecated and should be
switched away from.
diff --git a/src/md5.c b/src/md5.c
index da99876..00769aa 100644
--- a/src/md5.c
+++ b/src/md5.c
@@ -28,6 +28,7 @@
#include <stdlib.h>
#include <dlfcn.h>
#include <md5.h>
+#include "local-link.h"
static void (*libmd_MD5Init)(MD5_CTX *);
static void (*libmd_MD5Update)(MD5_CTX *, const uint8_t *, size_t);
@@ -65,6 +66,8 @@ MD5Init(MD5_CTX *context)
libmd_wrapper(MD5Init);
libmd_MD5Init(context);
}
+libbsd_link_warning(MD5Init,
+ "This function is a deprecated wrapper, use libmd instead.");
void
MD5Update(MD5_CTX *context, const uint8_t *data, size_t len)
@@ -72,6 +75,8 @@ MD5Update(MD5_CTX *context, const uint8_t *data, size_t len)
libmd_wrapper(MD5Update);
libmd_MD5Update(context, data, len);
}
+libbsd_link_warning(MD5Update,
+ "This function is a deprecated wrapper, use libmd instead.");
void
MD5Pad(MD5_CTX *context)
@@ -79,6 +84,8 @@ MD5Pad(MD5_CTX *context)
libmd_wrapper(MD5Pad);
libmd_MD5Pad(context);
}
+libbsd_link_warning(MD5Pad,
+ "This function is a deprecated wrapper, use libmd instead.");
void
MD5Final(uint8_t digest[MD5_DIGEST_LENGTH], MD5_CTX *context)
@@ -86,6 +93,8 @@ MD5Final(uint8_t digest[MD5_DIGEST_LENGTH], MD5_CTX *context)
libmd_wrapper(MD5Final);
libmd_MD5Final(digest, context);
}
+libbsd_link_warning(MD5Final,
+ "This function is a deprecated wrapper, use libmd instead.");
void
MD5Transform(uint32_t state[4], const uint8_t block[MD5_BLOCK_LENGTH])
@@ -93,6 +102,8 @@ MD5Transform(uint32_t state[4], const uint8_t block[MD5_BLOCK_LENGTH])
libmd_wrapper(MD5Transform);
libmd_MD5Transform(state, block);
}
+libbsd_link_warning(MD5Transform,
+ "This function is a deprecated wrapper, use libmd instead.");
char *
MD5End(MD5_CTX *context, char *buf)
@@ -100,6 +111,8 @@ MD5End(MD5_CTX *context, char *buf)
libmd_wrapper(MD5End);
return libmd_MD5End(context, buf);
}
+libbsd_link_warning(MD5End,
+ "This function is a deprecated wrapper, use libmd instead.");
char *
MD5File(const char *filename, char *buf)
@@ -107,6 +120,8 @@ MD5File(const char *filename, char *buf)
libmd_wrapper(MD5File);
return MD5File(filename, buf);
}
+libbsd_link_warning(MD5File,
+ "This function is a deprecated wrapper, use libmd instead.");
char *
MD5FileChunk(const char *filename, char *buf, off_t offset, off_t length)
@@ -114,6 +129,8 @@ MD5FileChunk(const char *filename, char *buf, off_t offset, off_t length)
libmd_wrapper(MD5FileChunk);
return libmd_MD5FileChunk(filename, buf, offset, length);
}
+libbsd_link_warning(MD5FileChunk,
+ "This function is a deprecated wrapper, use libmd instead.");
char *
MD5Data(const uint8_t *data, size_t len, char *buf)
@@ -121,3 +138,5 @@ MD5Data(const uint8_t *data, size_t len, char *buf)
libmd_wrapper(MD5Data);
return libmd_MD5Data(data, len, buf);
}
+libbsd_link_warning(MD5Data,
+ "This function is a deprecated wrapper, use libmd instead.");
commit 4feda8704972a1eac88b5ba9ff7add92c25245ab
Author: Guillem Jover <guillem at hadrons.org>
Date: Thu Feb 11 04:40:48 2021 +0100
Require a semicolon for libbsd_link_warning() macro
Remove the semicolon in the macro definition to force adding one on the
call sites, to make the code look like an actual function.
diff --git a/src/fgetln.c b/src/fgetln.c
index 7461a7a..502eb6f 100644
--- a/src/fgetln.c
+++ b/src/fgetln.c
@@ -77,7 +77,7 @@ fgetln(FILE *stream, size_t *len)
}
libbsd_link_warning(fgetln,
"This function cannot be safely ported, use getline(3) "
- "instead, as it is supported by GNU and POSIX.1-2008.")
+ "instead, as it is supported by GNU and POSIX.1-2008.");
#else
#error "Function fgetln() needs to be ported."
#endif
diff --git a/src/fgetwln.c b/src/fgetwln.c
index 1127655..e6a0a17 100644
--- a/src/fgetwln.c
+++ b/src/fgetwln.c
@@ -89,4 +89,4 @@ fgetwln(FILE *stream, size_t *lenp)
}
libbsd_link_warning(fgetwln,
"This function cannot be safely ported, use fgetwc(3) "
- "instead, as it is supported by C99 and POSIX.1-2001.")
+ "instead, as it is supported by C99 and POSIX.1-2001.");
diff --git a/src/local-link.h b/src/local-link.h
index 0d4351a..55fd028 100644
--- a/src/local-link.h
+++ b/src/local-link.h
@@ -29,7 +29,7 @@
#define libbsd_link_warning(symbol, msg) \
static const char libbsd_emit_link_warning_##symbol[] \
- __attribute__((__used__,__section__(".gnu.warning." #symbol))) = msg;
+ __attribute__((__used__,__section__(".gnu.warning." #symbol))) = msg
#ifdef __ELF__
#define libbsd_symver_default(alias, symbol, version) \
commit d563a17430845d043d667892c4457a14998dd4c3
Author: Guillem Jover <guillem at hadrons.org>
Date: Thu Feb 18 23:38:30 2021 +0100
man: Call the libbsd-ctor library by its name instead of bsd-ctor
diff --git a/man/libbsd.7 b/man/libbsd.7
index ebc6b9e..cad9e7c 100644
--- a/man/libbsd.7
+++ b/man/libbsd.7
@@ -73,7 +73,7 @@ such as
.In bsd/unistd.h .
.Pp
The package also provides a
-.Pa bsd-ctor
+.Nm libbsd-ctor
static library that can be used to inject automatic constructors into a
program so that the
.Fn setproctitle_init 3
commit 785cf9d1e97220483857dda9fe75728cd51e0d84
Author: Guillem Jover <guillem at hadrons.org>
Date: Thu Feb 18 23:38:30 2021 +0100
man: Fix pkg-config(1) references in libbsd(7) man page
diff --git a/man/libbsd.7 b/man/libbsd.7
index 3eada82..ebc6b9e 100644
--- a/man/libbsd.7
+++ b/man/libbsd.7
@@ -1,6 +1,6 @@
.\" libbsd man page
.\"
-.\" Copyright © 2017-2018 Guillem Jover <guillem at hadrons.org>
+.\" Copyright © 2017-2021 Guillem Jover <guillem at hadrons.org>
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
@@ -24,7 +24,7 @@
.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
.\" ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
-.Dd May 21, 2018
+.Dd Feb 13, 2021
.Dt LIBBSD 7
.Os
.Sh NAME
@@ -42,7 +42,7 @@ The library can be used in an overlay mode, which is the preferred way, so
that the code is portable and requires no modification to the original BSD
code.
This can be done easily with the
-.Xr pkg-config 3
+.Xr pkg-config 1
library named
.Pa libbsd-overlay .
Or by adding the system-specific include directory with the
@@ -64,7 +64,7 @@ this is less portable as it makes using
mandatory and it will not work on BSD-based systems, and requires
modifying original BSD code.
This can be done with the
-.Xr pkg-config 3
+.Xr pkg-config 1
library named
.Pa libbsd .
The includes in this case should be namespaced with
@@ -79,7 +79,7 @@ program so that the
.Fn setproctitle_init 3
function gets invoked automatically at startup time.
This can be done with the
-.Xr pkg-config 3
+.Xr pkg-config 1
library named
.Pa libbsd-ctor .
.Sh HEADERS
commit 15bd284b29411638b9434bf7c4c4b1feae32033a
Author: Guillem Jover <guillem at hadrons.org>
Date: Sun Feb 28 05:16:01 2021 +0100
build: Add code coverage support in the GitLab CI
diff --git a/.gitignore b/.gitignore
index 46ce104..c805925 100644
--- a/.gitignore
+++ b/.gitignore
@@ -7,6 +7,8 @@ ChangeLog
*.a
*.log
*.trs
+*.gcda
+*.gcno
.dirstamp
.deps/
.libs/
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 6fae8fe..ca88de2 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -1,10 +1,19 @@
image: debian:buster
-test:
- before_script:
- - apt-get update -qq
- - apt-get install -qq -y --no-install-recommends
- git gcc make autoconf automake libtool libmd-dev
+before_script:
+ - apt-get update -qq
+ - apt-get install -qq -y --no-install-recommends
+ git gcc make autoconf automake libtool libmd-dev gcovr
+
+unit-tests:
+ stage: test
script:
- ./autogen && ./configure
- make check
+
+coverage:
+ stage: test
+ script:
+ - ./autogen && ./configure --disable-static
+ - make check CFLAGS="--coverage -O0 -ggdb" LDFLAGS="--coverage -O0 -ggdb"
+ - gcovr -s -e test/
commit a9fc285988c010eaf1deb682c5d6335abf87ccab
Author: Guillem Jover <guillem at hadrons.org>
Date: Sun Feb 28 05:14:54 2021 +0100
build: Use apt-get instead of apt in the GitLab CI
The former is to be used programmatically, while the latter is intended
for interactive use.
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 21a1bc7..6fae8fe 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -2,8 +2,9 @@ image: debian:buster
test:
before_script:
- - apt update -qq
- - apt install -qq -y --no-install-recommends git gcc make autoconf automake libtool libmd-dev
+ - apt-get update -qq
+ - apt-get install -qq -y --no-install-recommends
+ git gcc make autoconf automake libtool libmd-dev
script:
- ./autogen && ./configure
- make check
More information about the libbsd
mailing list