Fixed: [Yang modules skipped if the name is a proper prefix of other module name](https://github.com/clicon/clixon/issues/130)
This commit is contained in:
parent
576533ed82
commit
96a8192cd2
2 changed files with 13 additions and 5 deletions
|
|
@ -35,6 +35,7 @@ Users may have to change how they access the system
|
||||||
|
|
||||||
### Corrected Bugs
|
### 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 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: [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)
|
* Fixed: [(CLI) the description of a used grouping is shown instead of the encapsulating container #124](https://github.com/clicon/clixon/issues/124)
|
||||||
|
|
|
||||||
|
|
@ -586,7 +586,7 @@ yang_parse_file(int fd,
|
||||||
|
|
||||||
/*! Given a yang filename, extract the revision as an integer as YYYYMMDD
|
/*! Given a yang filename, extract the revision as an integer as YYYYMMDD
|
||||||
* @param[in] filename Filename on the form: name [+ @rev ] + .yang
|
* @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)
|
* @param[out] revp Revision as YYYYMMDD (0 if not found)
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
|
|
@ -608,7 +608,7 @@ filename2revision(const char *filename,
|
||||||
*p = '\0';
|
*p = '\0';
|
||||||
if ((p = index(base, '@')) != NULL){ /* extract revision date */
|
if ((p = index(base, '@')) != NULL){ /* extract revision date */
|
||||||
*p++ = '\0';
|
*p++ = '\0';
|
||||||
if (ys_parse_date_arg(p, revp) < 0)
|
if (revp && ys_parse_date_arg(p, revp) < 0)
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
if (basep){
|
if (basep){
|
||||||
|
|
@ -1244,9 +1244,16 @@ yang_spec_load_dir(clicon_handle h,
|
||||||
else{ /* a@xxx.yang */
|
else{ /* a@xxx.yang */
|
||||||
if (taken)
|
if (taken)
|
||||||
continue; /* skip if already taken */
|
continue; /* skip if already taken */
|
||||||
/* Look forward: is there anyone else later? */
|
/* Look forward: is there anyone else later? (assume sorted revision dates) */
|
||||||
if (i+1<ndp && strncmp(base, dp[i+1].d_name, strlen(base)) == 0)
|
if (i+1 < ndp){ /* not last in list */
|
||||||
continue; /* same base: skip; */
|
char *nextbase = NULL; /* XXX suboptimal algorithm, could combione old/next/base */
|
||||||
|
if (filename2revision(dp[i+1].d_name, &nextbase, NULL) < 0)
|
||||||
|
goto done;
|
||||||
|
if (nextbase && strcmp(base, nextbase) == 0)
|
||||||
|
continue; /* same base: skip; */
|
||||||
|
if (nextbase)
|
||||||
|
free(nextbase);
|
||||||
|
}
|
||||||
taken = 1; /* last in line and not taken */
|
taken = 1; /* last in line and not taken */
|
||||||
}
|
}
|
||||||
/* Here only a single file is reached(taken)
|
/* Here only a single file is reached(taken)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue