From 96a8192cd21e88d9d5837ac5dfd4271ca01ffafc Mon Sep 17 00:00:00 2001 From: Olof hagsand Date: Thu, 27 Aug 2020 11:55:42 +0200 Subject: [PATCH] Fixed: [Yang modules skipped if the name is a proper prefix of other module name](https://github.com/clicon/clixon/issues/130) --- CHANGELOG.md | 1 + lib/src/clixon_yang_parse_lib.c | 17 ++++++++++++----- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a82f8043..fb97f02c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -35,6 +35,7 @@ Users may have to change how they access the system ### Corrected Bugs +* Fixed: [Yang modules skipped if the name is a proper prefix of other module name](https://github.com/clicon/clixon/issues/130) * Fixed an error in global default values. Global default values were not written to datastore after startup, but AFTER an edit/commit. * Fixed: [Type / Endianism problem in yang_parse_file #128](https://github.com/clicon/clixon/issues/128) * Fixed: [(CLI) the description of a used grouping is shown instead of the encapsulating container #124](https://github.com/clicon/clixon/issues/124) diff --git a/lib/src/clixon_yang_parse_lib.c b/lib/src/clixon_yang_parse_lib.c index f0131516..881ede13 100644 --- a/lib/src/clixon_yang_parse_lib.c +++ b/lib/src/clixon_yang_parse_lib.c @@ -586,7 +586,7 @@ yang_parse_file(int fd, /*! Given a yang filename, extract the revision as an integer as YYYYMMDD * @param[in] filename Filename on the form: name [+ @rev ] + .yang - * @param[out] basep "Base" filename, stripped: [+ @rev ] + .yang + * @param[out] basep "Base" filename, stripped: [+ @rev ] + .yang (malloced) * @param[out] revp Revision as YYYYMMDD (0 if not found) */ static int @@ -608,7 +608,7 @@ filename2revision(const char *filename, *p = '\0'; if ((p = index(base, '@')) != NULL){ /* extract revision date */ *p++ = '\0'; - if (ys_parse_date_arg(p, revp) < 0) + if (revp && ys_parse_date_arg(p, revp) < 0) goto done; } if (basep){ @@ -1244,9 +1244,16 @@ yang_spec_load_dir(clicon_handle h, else{ /* a@xxx.yang */ if (taken) continue; /* skip if already taken */ - /* Look forward: is there anyone else later? */ - if (i+1