rust-iptables
rust-iptables copied to clipboard
Allow nesting of single and double quotes inside rules
Previously the regular expression used in split_quoted
would
erroneously consider a single and double quote as a pair. This made it
impossible to have a comment with a nested quote.
The CI-failures seem to be unrelated to this PR. Apparently it tries to build a version of lazy-static which the minimum supported version of Rust, 1.13.0, doesn‘t compile. It seems like that is pulled in by a too-new version of the regex crate.
In case you want to fix it, pinning the version of the regex crate in Cargo.toml
to version 0.2.3
might be enough.
Actually test_old is failing on as well when has_check
is false. I haven't investigated, but I suspect it is because iptables -S
ends up escaping the nested quotes instead of using single vs double, so comparing input to output doesn't match. I'll note from my experience comparing intput to output of iptables -S
can differ for other reasons. For example if you have a long comment iptables -S
will truncate the comment.
Also the rust 1.13 build also fails from cfg-if
which is pulled in by nix
.
I've fixed the test_old for versions of iptables that don't support -C
. That also fixes the long comments problem, and the you have to uses double quotes instead of single quotes when using exists
problem.
I have not fixed the rust 1.13 dependency issues. I'm not sure what the goals of the project are and if you would prefer to pin dependencies or simply bump the minimum supported rust version.
@sbohrer Thanks for you contribution. CI errors has been fixed, could you please rebase to master branch and push your changes again?