Fixed: [XPath * stopped working in 7.3](https://github.com/clicon/clixon/issues/594)

This commit is contained in:
Olof hagsand 2025-03-02 11:09:34 +01:00
parent ed226a990c
commit 302762f5af
3 changed files with 25 additions and 3 deletions

View file

@ -24,6 +24,7 @@ Planned: April 2025
### Corrected Bugs ### Corrected Bugs
* Fixed: [XPath * stopped working in 7.3](https://github.com/clicon/clixon/issues/594)
* Fixed: [Templates with nc:operation "merge" causes bad diffs to be shows](https://github.com/clicon/clixon-controller/issues/187) * Fixed: [Templates with nc:operation "merge" causes bad diffs to be shows](https://github.com/clicon/clixon-controller/issues/187)
## 7.3.0 ## 7.3.0

View file

@ -142,6 +142,9 @@ nodetest_eval_namespace(cxobj *x,
char *ns1 = NULL; /* xml namespace */ char *ns1 = NULL; /* xml namespace */
char *ns2 = NULL; /* xpath namespace */ char *ns2 = NULL; /* xpath namespace */
/* Namespaces is s0, name is s1 */
if (strcmp(xs->xs_s1, "*")==0)
goto ok;
/* XML x -> prefix1 + name1 */ /* XML x -> prefix1 + name1 */
prefix1 = xml_prefix(x); prefix1 = xml_prefix(x);
name1 = xml_name(x); name1 = xml_name(x);
@ -169,9 +172,7 @@ nodetest_eval_namespace(cxobj *x,
} }
else if (strcmp(ns1, ns2) != 0) else if (strcmp(ns1, ns2) != 0)
goto fail; goto fail;
#ifdef XPATH_NS_ACCEPT_UNRESOLVED
ok: ok:
#endif
retval = 1; retval = 1;
done: /* retval set in preceding statement */ done: /* retval set in preceding statement */
return retval; return retval;

View file

@ -143,6 +143,12 @@ module clixon-example {
type string; type string;
} }
} }
container options {
leaf max-number {
type uint32;
default 50000;
}
}
} }
} }
EOF EOF
@ -556,7 +562,7 @@ EOF
new "given value show key" new "given value show key"
expectpart "$($clixon_util_xpath -D $DBG -f $dir/1.xml -n ex:urn:example:clixon -y $fyang < $dir/1.xpath)" 0 "<name>x</name>" expectpart "$($clixon_util_xpath -D $DBG -f $dir/1.xml -n ex:urn:example:clixon -y $fyang < $dir/1.xpath)" 0 "<name>x</name>"
# See https://github.com/clicon/clixon/issues/594
cat <<EOF > $dir/1.xpath cat <<EOF > $dir/1.xpath
/table/parameter[value='42']/value /table/parameter[value='42']/value
EOF EOF
@ -564,6 +570,20 @@ EOF
new "given value show value" new "given value show value"
expectpart "$($clixon_util_xpath -D $DBG -f $dir/1.xml -n ex:urn:example:clixon -y $fyang < $dir/1.xpath)" 0 "<value>42</value>" expectpart "$($clixon_util_xpath -D $DBG -f $dir/1.xml -n ex:urn:example:clixon -y $fyang < $dir/1.xpath)" 0 "<value>42</value>"
cat <<EOF > $dir/1.xml
<table xmlns="urn:example:clixon">
<options>
<max-number>50000</max-number>
</options>
</table>
EOF
new "xpath issue ok"
expectpart "$($clixon_util_xpath -D $DBG -f $dir/1.xml -n ex:urn:example:clixon -y $fyang -p "/ex:table/options/*")" 0 "<max-number>50000</max-number>"
new "xpath issue fail"
expectpart "$($clixon_util_xpath -D $DBG -f $dir/1.xml -n null:urn:ietf:params:xml:ns:netconf:base:1.0 -n ex:urn:example:clixon -y $fyang -p "/ex:table/ex:options/*")" 0 "<max-number>50000</max-number>"
rm -rf $dir rm -rf $dir
new "endtest" new "endtest"