Skip to content

Commit 3bbd13c

Browse files
committed
tree schema BUGFIX use all methods for searching schema files
Fixes #2390
1 parent d7834bc commit 3bbd13c

File tree

1 file changed

+5
-11
lines changed

1 file changed

+5
-11
lines changed

src/tree_schema_common.c

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -696,8 +696,6 @@ lysp_check_dup_identities(struct lysp_ctx *ctx, struct lysp_module *mod)
696696
* @param[in] revision Optional revision of the (sub)module to load, if NULL the newest revision is being loaded.
697697
* @param[in] main_ctx Parser context of the main module in case of loading submodule.
698698
* @param[in] main_name Main module name in case of loading submodule.
699-
* @param[in] required Module is required so error (even if the input file not found) are important. If 0, there is some
700-
* backup and it is actually ok if the input data are not found. However, parser reports errors even in this case.
701699
* @param[in,out] new_mods Set of all the new mods added to the context. Includes this module and all of its imports.
702700
* @param[out] result Parsed YANG schema tree of the requested module (struct lys_module*) or submodule (struct lysp_submodule*).
703701
* If it is a module, it is already in the context!
@@ -706,7 +704,7 @@ lysp_check_dup_identities(struct lysp_ctx *ctx, struct lysp_module *mod)
706704
*/
707705
static LY_ERR
708706
lys_parse_localfile(struct ly_ctx *ctx, const char *name, const char *revision, struct lysp_ctx *main_ctx,
709-
const char *main_name, ly_bool required, struct ly_set *new_mods, void **result)
707+
const char *main_name, struct ly_set *new_mods, void **result)
710708
{
711709
struct ly_in *in;
712710
char *filepath = NULL;
@@ -718,11 +716,7 @@ lys_parse_localfile(struct ly_ctx *ctx, const char *name, const char *revision,
718716
LY_CHECK_RET(lys_search_localfile(ly_ctx_get_searchdirs(ctx), !(ctx->flags & LY_CTX_DISABLE_SEARCHDIR_CWD), name,
719717
revision, &filepath, &format));
720718
if (!filepath) {
721-
if (required) {
722-
LOGERR(ctx, LY_ENOTFOUND, "Module \"%s%s%s\" not found in local searchdirs.", name, revision ? "@" : "",
723-
revision ? revision : "");
724-
ret = LY_ENOTFOUND;
725-
}
719+
LOGVRB("Module \"%s%s%s\" not found in local searchdirs.", name, revision ? "@" : "", revision ? revision : "");
726720
goto cleanup;
727721
}
728722

@@ -810,7 +804,7 @@ lys_parse_load_from_clb_or_file(struct ly_ctx *ctx, const char *name, const char
810804
/* check we can use searchdirs and that we should */
811805
if (!(ctx->flags & LY_CTX_DISABLE_SEARCHDIRS) &&
812806
(!mod_latest || !(mod_latest->latest_revision & LYS_MOD_LATEST_SEARCHDIRS))) {
813-
LY_CHECK_RET(lys_parse_localfile(ctx, name, revision, NULL, NULL, mod_latest ? 0 : 1, new_mods, (void **)mod));
807+
LY_CHECK_RET(lys_parse_localfile(ctx, name, revision, NULL, NULL, new_mods, (void **)mod));
814808
}
815809
if (*mod && !revision) {
816810
/* we got the latest revision module in the searchdirs */
@@ -1179,8 +1173,8 @@ lysp_load_submodules(struct lysp_ctx *pctx, struct lysp_module *pmod, struct ly_
11791173
search_file:
11801174
if (!(ctx->flags & LY_CTX_DISABLE_SEARCHDIRS)) {
11811175
/* submodule was not received from the callback or there is no callback set */
1182-
lys_parse_localfile(ctx, inc->name, inc->rev[0] ? inc->rev : NULL, pctx->main_ctx,
1183-
PARSER_CUR_PMOD(pctx->main_ctx)->mod->name, 1, new_mods, (void **)&submod);
1176+
LY_CHECK_RET(lys_parse_localfile(ctx, inc->name, inc->rev[0] ? inc->rev : NULL, pctx->main_ctx,
1177+
PARSER_CUR_PMOD(pctx->main_ctx)->mod->name, new_mods, (void **)&submod));
11841178

11851179
/* update inc pointer - parsing another (YANG 1.0) submodule can cause injecting
11861180
* submodule's include into main module, where it is missing */

0 commit comments

Comments
 (0)