Skip to content

Commit

Permalink
Merge pull request flux-framework#5390 from garlick/issue#5387
Browse files Browse the repository at this point in the history
do not search for module and connector DSOs recursively
  • Loading branch information
mergify[bot] authored Aug 15, 2023
2 parents c6bc033 + c44132a commit d69f9d7
Show file tree
Hide file tree
Showing 12 changed files with 82 additions and 109 deletions.
4 changes: 0 additions & 4 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -559,10 +559,6 @@ AC_CONFIG_FILES( \
src/cmd/Makefile \
src/shell/Makefile \
src/connectors/Makefile \
src/connectors/local/Makefile \
src/connectors/shmem/Makefile \
src/connectors/loop/Makefile \
src/connectors/ssh/Makefile \
src/modules/Makefile \
src/modules/kvs/Makefile \
src/modules/content-files/Makefile \
Expand Down
2 changes: 1 addition & 1 deletion src/broker/broker.c
Original file line number Diff line number Diff line change
Expand Up @@ -1207,7 +1207,7 @@ static int load_module (broker_ctx_t *ctx,
return -1;
}
if (!(files = dirwalk_find (searchpath,
DIRWALK_REALPATH,
DIRWALK_REALPATH | DIRWALK_NORECURSE,
pattern,
1,
NULL,
Expand Down
2 changes: 1 addition & 1 deletion src/common/libflux/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ installed_conf_cppflags = \

intree_conf_cppflags = \
-DINTREE_MODULE_PATH=\"$(abs_top_builddir)/src/modules/.libs\" \
-DINTREE_CONNECTOR_PATH=\"$(abs_top_builddir)/src/connectors\" \
-DINTREE_CONNECTOR_PATH=\"$(abs_top_builddir)/src/connectors/.libs\" \
-DINTREE_EXEC_PATH=\"$(abs_top_builddir)/src/cmd:$(abs_top_srcdir)/src/cmd:$(abs_top_builddir)/src/broker\" \
-DINTREE_LUA_PATH_ADD=\"$(abs_top_builddir)/t/?.lua\;$(abs_top_srcdir)/src/bindings/lua/?.lua\" \
-DINTREE_LUA_CPATH_ADD=\"$(abs_top_builddir)/src/bindings/lua/?.so\" \
Expand Down
7 changes: 6 additions & 1 deletion src/common/libflux/handle.c
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,12 @@ static char *find_file (const char *name, const char *searchpath)
{
char *path;
zlist_t *l;
if (!(l = dirwalk_find (searchpath, DIRWALK_REALPATH, name, 1, NULL, NULL)))
if (!(l = dirwalk_find (searchpath,
DIRWALK_REALPATH | DIRWALK_NORECURSE,
name,
1,
NULL,
NULL)))
return NULL;
path = zlist_pop (l);
zlist_destroy (&l);
Expand Down
5 changes: 3 additions & 2 deletions src/common/libutil/dirwalk.c
Original file line number Diff line number Diff line change
Expand Up @@ -233,15 +233,16 @@ static int dirwalk_traverse (dirwalk_t *d, dirwalk_filter_f fn, void *arg)
dirwalk_stop (d, errno);
continue;
}
if (S_ISDIR (d->current->sb.st_mode)) {
if (S_ISDIR (d->current->sb.st_mode)
&& !(d->flags & DIRWALK_NORECURSE)) {
/*
* Save current direntry onto stack and call traverse()
*/
zlist_push (d->dirstack, d->current);
(void) dirwalk_traverse (d, fn, arg);
d->current = zlist_pop (d->dirstack);
}
else /* Not A directory, simply visit this file */
else /* Not a directory or NORECURSE, simply visit this object */
dirwalk_visit (d, fn, arg);
direntry_destroy (d->current);
d->current = NULL;
Expand Down
1 change: 1 addition & 0 deletions src/common/libutil/dirwalk.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ enum {
DIRWALK_DEPTH = 1<<0, /* Traverse in depth-first order */
DIRWALK_REALPATH = 1<<1, /* Resolve all paths with realpath(3) */
DIRWALK_FIND_DIR = 1<<2, /* Do not skip directories in dirwalk_find() */
DIRWALK_NORECURSE = 1<<3, /* Do not descend into directories */
};

/*
Expand Down
17 changes: 15 additions & 2 deletions src/common/libutil/test/dirwalk.c
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ static char * create_test_dir ()

static int find_dir (dirwalk_t *d, void *arg)
{
return (dirwalk_isdir (d) ? 1 : 0);
return (dirwalk_isdir (d) ? 1 : 0);
}

static int return_err (dirwalk_t *d, void *arg)
Expand Down Expand Up @@ -232,6 +232,9 @@ int main(int argc, char** argv)
n = dirwalk (tmp, 0, NULL, NULL);
ok (n == 4, "dirwalk of deeper dirtree");

n = dirwalk (tmp, DIRWALK_NORECURSE, NULL, NULL);
ok (n == 2, "dirwalk of deeper dirtree with NORECURSE works");

if (makepath ("%s/a/b/c/d", tmp) < 0)
BAIL_OUT ("makepath failed");

Expand Down Expand Up @@ -280,7 +283,7 @@ int main(int argc, char** argv)
ok (l && zlist_size (l) == 3, "find with search path found all matches");
zlist_destroy (&l);
free (s);

/* depth-first find */
l = dirwalk_find (tmp, DIRWALK_DEPTH, "foo", 0, NULL, 0);
ok (l != NULL, "dirwalk with find callback");
Expand All @@ -304,6 +307,16 @@ int main(int argc, char** argv)
"depth-first visited directories in correct order");
zlist_destroy (&l);

l = dirwalk_find (tmp,
DIRWALK_FIND_DIR | DIRWALK_NORECURSE,
"*",
0,
find_dir,
NULL);
ok (l != NULL && zlist_size (l) == 2,
"dirwalk_find FIND_DIR|NORECURSE vists top level directories");
zlist_destroy (&l);

flags = DIRWALK_FIND_DIR;
l = dirwalk_find (tmp, flags, "*", 0, find_dir, NULL);
ok (l && zlist_size (l) > 0, "dirwalk to find all dirs works");
Expand Down
56 changes: 55 additions & 1 deletion src/connectors/Makefile.am
Original file line number Diff line number Diff line change
@@ -1 +1,55 @@
SUBDIRS = local shmem loop ssh
AM_CFLAGS = \
$(WARNING_CFLAGS) \
$(CODE_COVERAGE_CFLAGS)

AM_LDFLAGS = \
$(CODE_COVERAGE_LIBS)

AM_CPPFLAGS = \
-I$(top_srcdir) \
-I$(top_srcdir)/src/include \
-I$(top_builddir)/src/common/libflux \
-I$(top_srcdir)/src/common/libccan

fluxconnector_LTLIBRARIES = \
local.la \
loop.la \
shmem.la \
ssh.la

connector_ldflags = -module $(san_ld_zdef_flag) \
-export-symbols-regex '^connector_init$$' \
--disable-static -avoid-version -shared -export-dynamic

local_la_SOURCES = \
local/local.c
local_la_LIBADD = \
$(top_builddir)/src/common/libflux-internal.la \
$(top_builddir)/src/common/libflux-core.la
local_la_LDFLAGS = $(connector_ldflags)

loop_la_SOURCES = \
loop/loop.c
loop_la_LIBADD = \
$(top_builddir)/src/common/libflux-internal.la \
$(top_builddir)/src/common/libflux-core.la
loop_la_LDFLAGS = $(connector_ldflags)

shmem_la_SOURCES = \
shmem/shmem.c
shmem_la_CPPFLAGS = \
$(AM_CPPFLAGS) \
$(ZMQ_CFLAGS)
shmem_la_LIBADD = \
$(top_builddir)/src/common/libflux-internal.la \
$(top_builddir)/src/common/libflux-core.la \
$(top_builddir)/src/common/libzmqutil/libzmqutil.la \
$(ZMQ_LIBS)
shmem_la_LDFLAGS = $(connector_ldflags)

ssh_la_SOURCES = \
ssh/ssh.c
ssh_la_LIBADD = \
$(top_builddir)/src/common/libflux-internal.la \
$(top_builddir)/src/common/libflux-core.la
ssh_la_LDFLAGS = $(connector_ldflags)
24 changes: 0 additions & 24 deletions src/connectors/local/Makefile.am

This file was deleted.

23 changes: 0 additions & 23 deletions src/connectors/loop/Makefile.am

This file was deleted.

27 changes: 0 additions & 27 deletions src/connectors/shmem/Makefile.am

This file was deleted.

23 changes: 0 additions & 23 deletions src/connectors/ssh/Makefile.am

This file was deleted.

0 comments on commit d69f9d7

Please sign in to comment.