Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

port to musl and add alpine CI build #182

Merged
merged 8 commits into from
Nov 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .readthedocs.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
# Required
version: 2

build:
os: ubuntu-22.04
tools:
python: "3.11"

# Build documentation in the docs/ directory with Sphinx
sphinx:
configuration: doc/conf.py
Expand Down
2 changes: 1 addition & 1 deletion src/imp/exec/exec.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
#include <errno.h>
#include <assert.h>
#include <sys/types.h>
#include <wait.h>
#include <sys/wait.h>
#include <jansson.h>

#include "src/libutil/kv.h"
Expand Down
6 changes: 6 additions & 0 deletions src/imp/pidinfo.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,12 @@
#ifdef HAVE_LINUX_MAGIC_H
#include <linux/magic.h>
#endif
#ifndef TMPFS_MAGIC
#define TMPFS_MAGIC 0x01021994 /* from linux/magic.h */
#endif
#ifndef CGROUP_SUPER_MAGIC
#define CGROUP_SUPER_MAGIC 0x27e0eb
#endif

#include <pwd.h>
#include <signal.h>
Expand Down
2 changes: 1 addition & 1 deletion src/imp/test/pidinfo.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#include <stdio.h>
#include <errno.h>
#include <sys/types.h>
#include <wait.h>
#include <sys/wait.h>
#include <unistd.h>
#include <string.h>

Expand Down
2 changes: 2 additions & 0 deletions src/lib/sign.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
#ifndef _FLUX_SECURITY_SIGN_H
#define _FLUX_SECURITY_SIGN_H

#include <stdint.h>

#ifdef __cplusplus
extern "C" {
#endif
Expand Down
12 changes: 10 additions & 2 deletions src/libutil/test/cf.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
#include <limits.h>
#include <errno.h>
#include <jansson.h>
#include <glob.h>

#include "src/libtap/tap.h"
#include "cf.h"
Expand Down Expand Up @@ -79,7 +80,7 @@ static time_t strtotime (const char *s)
{
Copy link
Member

@garlick garlick Nov 17, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Commit message typo here. Says %T-%m-%d(twice) but should be %Y-%m-%d.
Edit: Title also.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. Got it and force-pushed. Will set MWP.

struct tm tm;
time_t t;
if (!strptime (s, "%FT%TZ", &tm))
if (!strptime (s, "%Y-%m-%dT%TZ", &tm))
BAIL_OUT ("strptime: %s failed", s);
if ((t = timegm (&tm)) < 0)
BAIL_OUT ("timegm: %s failed", s);
Expand Down Expand Up @@ -528,6 +529,7 @@ void test_update_glob (void)
char path3[PATH_MAX + 1];
char invalid[PATH_MAX + 1];
char p [8192];
glob_t gl;

cf_t *cf;
const cf_t *cf2, *cf3;
Expand Down Expand Up @@ -567,18 +569,24 @@ void test_update_glob (void)
ok ((cf3 = cf_get_in (cf, "tab3")) != NULL,
"found tab3 table in cf");


errno = 0;
ok ((cf_update_glob (cf, "/noexist*", &error) == 0),
"cf_update_glob returns 0 on no match");
diag ("%s: %d: %s", error.filename, error.lineno, error.errbuf);
like (error.errbuf, "[nN]o [mM]atch", "got expected error text");


/* Only run the following tests if this implementation of glob(3)
* returns GLOB_ABORTED when parent dir does not exist. This occurs
* for example on the musl libc version of glob(3).
*/
skip (glob ("/noexist/*", GLOB_ERR, NULL, &gl) != GLOB_ABORTED, 2);
errno = 0;
ok ((cf_update_glob (cf, "/noexist/*", &error) < 0) && errno == EINVAL,
"cf_update_glob fails on read error");
diag ("%s: %d: %s", error.filename, error.lineno, error.errbuf);
like (error.errbuf, "[rR]ead [eE]rror", "got expected error text");
end_skip;

cf_destroy (cf);

Expand Down
2 changes: 1 addition & 1 deletion src/libutil/test/tomltk.c
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ static bool check_ts (json_t *ts, const char *timestr)
return false;
if (!gmtime_r (&t, &tm))
return false;
if (strftime (buf, sizeof (buf), "%FT%TZ", &tm) == 0)
if (strftime (buf, sizeof (buf), "%Y-%m-%dT%TZ", &tm) == 0)
return false;
diag ("%s: %s ?= %s", __FUNCTION__, buf, timestr);
return !strcmp (buf, timestr);
Expand Down
4 changes: 2 additions & 2 deletions src/libutil/timestamp.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ int timestamp_tostr (time_t t, char *buf, int size)
struct tm tm;
if (t < 0 || !gmtime_r (&t, &tm))
return -1;
if (strftime (buf, size, "%FT%TZ", &tm) == 0)
if (strftime (buf, size, "%Y-%m-%dT%TZ", &tm) == 0)
return -1;
return 0;
}
Expand All @@ -30,7 +30,7 @@ int timestamp_fromstr (const char *s, time_t *tp)
{
struct tm tm;
time_t t;
if (!strptime (s, "%FT%TZ", &tm))
if (!strptime (s, "%Y-%m-%dT%TZ", &tm))
return -1;
if ((t = timegm (&tm)) < 0)
return -1;
Expand Down
7 changes: 7 additions & 0 deletions src/test/generate-matrix.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,4 +155,11 @@ def __str__(self):
args="--enable-sanitizers",
pam=False, # asan not compatible with PAM tests
)

# alpine
matrix.add_build(
name="alpine",
image="alpine",
)

print(matrix)
6 changes: 2 additions & 4 deletions t/src/getpwuid.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,22 +24,20 @@
struct passwd *getpwuid (uid_t uid)
{
const char *filename;
static char buf[4096];
static struct passwd pw;
struct passwd *pwp = NULL;

if ((filename = getenv ("TEST_PASSWD_FILE"))) {
FILE *f;
if ((f = fopen (filename, "r"))) {
while (fgetpwent_r (f, &pw, buf, sizeof (buf), &pwp) == 0) {
while ((pwp = fgetpwent (f))) {
if (pwp->pw_uid == uid)
break;
}
(void)fclose (f);
}
}
else
getpwuid_r (uid, &pw, buf, sizeof (buf), &pwp);
pwp = getpwuid (uid);

if (pwp == NULL)
errno = ENOENT;
Expand Down
1 change: 1 addition & 0 deletions t/src/sign.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include <stdint.h>

#include "src/lib/context.h"
#include "src/lib/sign.h"
Expand Down