-
Notifications
You must be signed in to change notification settings - Fork 200
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to write out a literal backslash character? #507
Comments
That indeed seems strange. Just for my clarification, I put together this test; the put test is the behavior you are looking for, right ? I'll have a look at what is happening there.
|
Found the problem - backslashes in those strings were indeed interpreted twice. PR should be up in a minute |
…t out We already unescape the default for a del when we read the lens file. Doing it during put will cause two rounds of unescaping to happen, which is wrong. Fixes: hercules-team#507
…t out We already unescape the default for a del when we read the lens file. Doing it during put will cause two rounds of unescaping to happen, which is wrong. Fixes: hercules-team#507
Yep, I've just tested my lens against your PR changes and it now creates new entries correctly. |
I think this same issue is present elsewhere in the codebase, consider this test case (also from #274):
I've backslash-escaped the
I get errors like:
If I take the backslashes out of the expected output then there are no syntax errors but of course the test fails because actual/expected don't match. |
I'll look into it. Could you rebase #274 onto the HEAD of master and make sure it has your latest changes to the lens and tests ? That'll make it easier for me to understand what's happening - I'll try in the meantime to repro this with a small example. |
This is a manifestation of the bug fixed in 244c0ed; what happens is that the |
Now that we know hercules-team#507 is a thing just leave the smallest set of test cases present. The termcap monsters will need to be added back and the lens is currently broken for rtadvd.conf which contains quoted :'s.
I'm afraid I initially just merged your PR into my very ancient branch without also rebasing it onto the HEAD of master. I've rebased my branch and for now pared down the tests so the only thing currently failing is the above test case and its backslashes. |
The backslash part of the tests now work (in the sense that they do not cause syntax errors) What's failing now seem to be 'normal' typecheck errors. |
Yeah, I made the mistake of not using the compiled |
As part of #274 (which I'm trying to revive and get working), I have the fundamental problem that I cannot get Augeas to write out a literal
\
character as part of a separator implemented withdel
.My lens contains the following:
which (if I've got it right) should match in the get direction at least a colon, optionally followed by any amount of whitespace, a backslash, a newline, any amount of whitespace and finally another colon. On create it should always write a colon, a backslash, a newline, a tab and another colon.
This reads in existing entries correctly but new entries are always written out minus the backslash, i.e. just the colon, newline, tab and colon. The backslash has somehow been swallowed.
I'm not sure if I'm over-escaping the backslashes or not, but if I change them on either side from what's above then I tend to get a lens error of the form:
Is this a bug perhaps? How do I write out a literal backslash?
The text was updated successfully, but these errors were encountered: