libs: Do not rely on nftw for detecting the validity of plugin path
authorJonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Wed, 19 Jun 2019 17:27:21 +0000 (13:27 -0400)
committerPhilippe Proulx <eeppeliteloop@gmail.com>
Thu, 27 Jun 2019 04:55:27 +0000 (00:55 -0400)
commit037cbd1ac687161b52b6e1c5fd49dcd9d79a878f
tree3b03d7bab6b212ffb2ffc0e11694192551287791
parent060cf347f8b8267f953b2c9834d71e83d2aca558
libs: Do not rely on nftw for detecting the validity of plugin path

test_plugin.c:test_create_all_from_dir with non existing path fails on
cygwin. An error is expected but bt_plugin_find_all_from_dir returns
success.

The cygwin implementation of nftw is not posix compliant regarding
returning ENOENT on non-existent path. [1] [2]

The cygwin implementation of nftw does not return ENOENT on non-existent
path. Instead, the non-existent path is passed through the fn function
(nftw_append_all_from_dir) and the flag is set to FTW_NS.

Since we are "discovering" plugins, nftw_append_all_from_dir does not
error out on FTW_NS and simply skip the file.

The proposed solution is to stat() the provided path and validate that
no errors occur before using nftw().

[1] https://pubs.opengroup.org/onlinepubs/9699919799/functions/nftw.html
[2] https://cygwin.com/ml/cygwin/2019-06/msg00185.html

Change-Id: Ia7c88dbab5b16affbdb8ce1dbe261b03635727cc
Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1520
CI-Build: Philippe Proulx <eeppeliteloop@gmail.com>
Tested-by: jenkins <jenkins@lttng.org>
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
src/lib/plugin/plugin.c
This page took 0.025954 seconds and 4 git commands to generate.