From f035c3ca2317cfc679f7c623594bf261366be94e Mon Sep 17 00:00:00 2001 From: Olof Hagsand Date: Wed, 27 Feb 2019 10:32:11 +0100 Subject: [PATCH] * Removed all dependency on strverscmp * Added libgen.h for baseline() --- CHANGELOG.md | 4 +++- apps/backend/backend_plugin.c | 1 - apps/backend/backend_socket.c | 2 +- apps/cli/cli_main.c | 1 - configure | 2 +- configure.ac | 2 +- docker/system/startsystem.sh | 8 ++++++-- include/clixon_config.h.in | 3 --- include/clixon_custom.h | 6 ------ lib/clixon/clixon_yang.h | 2 +- lib/src/clixon_file.c | 5 ----- lib/src/clixon_yang.c | 5 ++--- lib/src/clixon_yang_cardinality.c | 1 - lib/src/clixon_yang_type.c | 1 - test/test_install.sh | 3 ++- test/test_upgrade.sh | 6 +++--- util/clixon_util_yang.c | 1 - 17 files changed, 20 insertions(+), 33 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c40e8ffa..6922cfd2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -25,7 +25,9 @@ ### Minor changes * Added specific clixon_suberrno code: XMLPARSE_ERRNO to identify XML parse errors. - +* Removed all dependency on strverscmp +* Added libgen.h for baseline() + ### Corrected Bugs ## 3.9.0 (21 Feb 2019) diff --git a/apps/backend/backend_plugin.c b/apps/backend/backend_plugin.c index 65ab9cdc..8635a156 100644 --- a/apps/backend/backend_plugin.c +++ b/apps/backend/backend_plugin.c @@ -39,7 +39,6 @@ #endif #include -#define __USE_GNU /* strverscmp */ #include #include #include diff --git a/apps/backend/backend_socket.c b/apps/backend/backend_socket.c index d7d49183..c41b2658 100644 --- a/apps/backend/backend_socket.c +++ b/apps/backend/backend_socket.c @@ -55,7 +55,7 @@ #include #include #endif -#define __USE_GNU +#define __USE_GNU /* for ucred */ #define _GNU_SOURCE /* for ucred */ #include #include diff --git a/apps/cli/cli_main.c b/apps/cli/cli_main.c index bc391c34..8fce8dbc 100644 --- a/apps/cli/cli_main.c +++ b/apps/cli/cli_main.c @@ -39,7 +39,6 @@ #endif #include -#define __USE_GNU /* strverscmp */ #include #include #include diff --git a/configure b/configure index cf5cab24..899236bb 100755 --- a/configure +++ b/configure @@ -4417,7 +4417,7 @@ _ACEOF fi -for ac_func in inet_aton sigaction sigvec strlcpy strsep strndup alphasort versionsort strverscmp +for ac_func in inet_aton sigaction sigvec strlcpy strsep strndup alphasort versionsort do : as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" diff --git a/configure.ac b/configure.ac index 13ee24a1..e2947ad7 100644 --- a/configure.ac +++ b/configure.ac @@ -220,7 +220,7 @@ AC_CHECK_LIB(socket, socket) AC_CHECK_LIB(nsl, xdr_char) AC_CHECK_LIB(dl, dlopen) -AC_CHECK_FUNCS(inet_aton sigaction sigvec strlcpy strsep strndup alphasort versionsort strverscmp) +AC_CHECK_FUNCS(inet_aton sigaction sigvec strlcpy strsep strndup alphasort versionsort) # CLIXON_DATADIR is where clixon installs the "system" yang files in yang/Makfile # This directory should most probably be included in each application, diff --git a/docker/system/startsystem.sh b/docker/system/startsystem.sh index e4c5f9db..9ba777f6 100755 --- a/docker/system/startsystem.sh +++ b/docker/system/startsystem.sh @@ -46,10 +46,14 @@ server { } EOF -# This is a clixon site test file. Disable all model testing. +# This is a clixon site test file. +# Add to skiplist: +# - all 3rd party model testing (you need to download the repos) +# - test_install.sh since you dont have the make environment +# - test_order.sh XXX this is a bug need debugging cat < /usr/local/bin/test/site.sh # Add your local site specific env variables (or tests) here. -SKIPLIST="test_yangmodels.sh test_openconfig.sh test_install.sh test_order.sh test_startup.sh test_upgrade.sh" +SKIPLIST="test_yangmodels.sh test_openconfig.sh test_install.sh test_order.sh" #IETFRFC= EOF diff --git a/include/clixon_config.h.in b/include/clixon_config.h.in index f8678e33..a3f841ca 100644 --- a/include/clixon_config.h.in +++ b/include/clixon_config.h.in @@ -90,9 +90,6 @@ /* Define to 1 if you have the `strsep' function. */ #undef HAVE_STRSEP -/* Define to 1 if you have the `strverscmp' function. */ -#undef HAVE_STRVERSCMP - /* Define to 1 if you have the header file. */ #undef HAVE_SYS_STAT_H diff --git a/include/clixon_custom.h b/include/clixon_custom.h index 187183e6..ee8bd231 100644 --- a/include/clixon_custom.h +++ b/include/clixon_custom.h @@ -37,12 +37,6 @@ #define strndup(s, n) clicon_strndup(s, n) #endif -#if defined(__OpenBSD__) || defined(__FreeBSD__) || defined(__NetBSD__) -#define BSD -/* at least for openbsd 4.5 i cannot get a hdr file */ -int strverscmp (__const char *__s1, __const char *__s2); -#endif - /* Set if you want to assert that all rpc messages have set username */ #undef RPC_USERNAME_ASSERT diff --git a/lib/clixon/clixon_yang.h b/lib/clixon/clixon_yang.h index 1035a429..b0ecb3e1 100644 --- a/lib/clixon/clixon_yang.h +++ b/lib/clixon/clixon_yang.h @@ -281,7 +281,7 @@ int yang_mandatory(yang_stmt *ys); int yang_config(yang_stmt *ys); int yang_spec_parse_module(clicon_handle h, const char *module, const char *revision, yang_spec *yspec); -int yang_spec_parse_file(clicon_handle h, const char *filename, yang_spec *yspec); +int yang_spec_parse_file(clicon_handle h, char *filename, yang_spec *yspec); int yang_spec_load_dir(clicon_handle h, char *dir, yang_spec *yspec); cvec *yang_arg2cvec(yang_stmt *ys, char *delimi); int yang_key_match(yang_node *yn, char *name); diff --git a/lib/src/clixon_file.c b/lib/src/clixon_file.c index 38a0234a..47a2593d 100644 --- a/lib/src/clixon_file.c +++ b/lib/src/clixon_file.c @@ -39,7 +39,6 @@ #include #include -#define __USE_GNU /* strverscmp */ #include #include #include @@ -71,11 +70,7 @@ clicon_file_dirent_sort(const void* arg1, struct dirent *d1 = (struct dirent *)arg1; struct dirent *d2 = (struct dirent *)arg2; -#ifdef HAVE_STRVERSCMP - return strverscmp(d1->d_name, d2->d_name); /* strverscmp specific GNU function */ -#else /* HAVE_STRVERSCMP */ return strcoll(d1->d_name, d2->d_name); -#endif /* HAVE_STRVERSCMP */ } /*! Return alphabetically sorted files from a directory matching regexp diff --git a/lib/src/clixon_yang.c b/lib/src/clixon_yang.c index 4d977b12..1e3eddda 100644 --- a/lib/src/clixon_yang.c +++ b/lib/src/clixon_yang.c @@ -56,8 +56,6 @@ #include #include #include -#define __USE_GNU /* strverscmp */ -#define _GNU_SOURCE #include #include #include @@ -66,6 +64,7 @@ #include #include #include +#include #include #include #include @@ -2449,7 +2448,7 @@ yang_spec_parse_module(clicon_handle h, */ int yang_spec_parse_file(clicon_handle h, - const char *filename, + char *filename, yang_spec *yspec) { int retval = -1; diff --git a/lib/src/clixon_yang_cardinality.c b/lib/src/clixon_yang_cardinality.c index 8d6d4fba..ac7e594d 100644 --- a/lib/src/clixon_yang_cardinality.c +++ b/lib/src/clixon_yang_cardinality.c @@ -44,7 +44,6 @@ #include #include #include -#define __USE_GNU /* strverscmp */ #include #include #include diff --git a/lib/src/clixon_yang_type.c b/lib/src/clixon_yang_type.c index 2cbdf95d..60820e0b 100644 --- a/lib/src/clixon_yang_type.c +++ b/lib/src/clixon_yang_type.c @@ -44,7 +44,6 @@ #include #include #include -#define __USE_GNU /* strverscmp */ #include #include #include diff --git a/test/test_install.sh b/test/test_install.sh index 172e1545..f92bc9bc 100755 --- a/test/test_install.sh +++ b/test/test_install.sh @@ -11,7 +11,6 @@ new "Make DESTDIR install" if [ $? -ne 0 ]; then err fi - new "Check installed files /usr" if [ ! -d $dir/usr ]; then err $dir/usr @@ -59,3 +58,5 @@ l=$(find $dir -type l) if [ -n "$l" ]; then err "$l" fi + +rm -rf $dir diff --git a/test/test_upgrade.sh b/test/test_upgrade.sh index 295b5ec4..10b6f48c 100755 --- a/test/test_upgrade.sh +++ b/test/test_upgrade.sh @@ -311,17 +311,17 @@ runtest startup 'always workalways work' 'always workother textold versionbla bla' +runtest startup 'always work' 'old versionalways workother textbla bla' new "5. Load non-compat invalid running. Enter failsafe, startup invalid." (cd $dir; rm -f tmp_db candidate_db running_db startup_db) # remove databases (cd $dir; cp non-compat-invalid.xml running_db) -runtest running 'always work' 'always workother textold versionbla bla' +runtest running 'always work' 'old versionalways workother textbla bla' new "6. Load compatible invalid startup." (cd $dir; rm -f tmp_db candidate_db running_db startup_db) # remove databases (cd $dir; cp compat-invalid.xml startup_db) -runtest startup 'always work' 'always workother textold versionbla bla' +runtest startup 'always work' 'old versionalways workother textbla bla' new "7. Load non-compat startup. Syntax fail, enter failsafe, startup invalid" (cd $dir; rm -f tmp_db candidate_db running_db startup_db) # remove databases diff --git a/util/clixon_util_yang.c b/util/clixon_util_yang.c index 1be09377..b7e0bf1d 100644 --- a/util/clixon_util_yang.c +++ b/util/clixon_util_yang.c @@ -45,7 +45,6 @@ #include #include #include -#define __USE_GNU /* strverscmp */ #include #include #include