Description
Details
- Version
- -
- Is it a breaking change?
- Perfectly compatible
- Issue type
- Bug (incorrect behavior)
Status | Subtype | Assigned | Task | ||
---|---|---|---|---|---|
Open | BUG | dmbaturin | T5938 Migration fail root task for 1.4-rc | ||
Resolved | BUG | jestabro | T5939 [1.3.5 -> 1.4.0-RC1 Migration] as-path-list Entries Get Messed Up | ||
Resolved | BUG | jestabro | T5996 Incorrect behavior for backslash escapes in config save and compare commands | ||
Resolved | BUG | jestabro | T6103 DHCP-server bootfile-name double slash syntax weird behaviour |
Event Timeline
This turns out to be non-trivial, due to the interaction between legacy and modern behavior; nonetheless, a simple preliminary fix is in testing, and the task will be updated with the details when the PR is complete.
The examples in T5939 reveal a general issue that, although uncommon, needs to be rationalized. The modern parser requires single backslashes to be escaped, if in quoted strings, however (1) the legacy parser (unlike the modern parser) is inconsistent in quoting values (2) the existing solution escapes all single backslashes not a part of control sequences and makes no attempt to restore single backslashes when possible --- this is safe, but leads to redundant escaping of backslashes as revealed in the examples in T5939.
We still rely on the legacy representation of the config as the base record which is then passed to modern tools for all subsequent modifications: migration, save, config_dict, etc. Normalizing the output before passing to configtree is necessary.
As this affects migration and config only in corner cases, and any solution is potentially dangerous, the solution below will be recommended for 1.5 but NOT for backport until some time is spent in the rolling release. The latter recommendation assumes that a workaround is available for the issue of T5939 and any similar examples.
Proposed fix in preparation:
https://github.com/vyos/vyos-1x/compare/current...jestabro:replace-backslash
The above will normalize behavior for 1.4/1.5, such that output of save and compare will correctly reflect set values containing single backslashes. What is cannot do is avoid a single escape of '\' --> '\\' when migrating a config value containing a single backslash and no white space (idiosyncrasy of legacy output); consequently, although controlling behavior, a full solution there would be ugly and fragile; a simple workaround however could be provided.
PR:
https://github.com/vyos/vyos-1x/pull/3035
After normalization of PR (compare with examples from T5939)
vyos@vyos# set interfaces ethernet eth0 description 'fo\o' [edit] vyos@vyos# compare [interfaces ethernet eth0] + description "fo\o" [edit] vyos@vyos# commit [edit] vyos@vyos# run show configuration commands |match desc set interfaces ethernet eth0 description 'fo\o' [edit] vyos@vyos# set interfaces ethernet eth0 description 'fo\\o' [edit] vyos@vyos# compare [interfaces ethernet eth0] - description "fo\o" + description "fo\\o" [edit] vyos@vyos# commit [edit] vyos@vyos# run show configuration commands |match desc set interfaces ethernet eth0 description 'fo\\o'