-
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
Augeas fails to parse properties-files with "/" in property names #668
Comments
This is a known issue, due to the fact that keys in Augeas cannot contain a slash. One way to fix this would be to split keys on |
I can't understand why keys cannot contain slashes. They seem to work perfectly when properly escaped. So just removing the slash from the forbidden characters seems to work:
regarding compatibility: I can't see how one could break compatibility for any properties file that contains a '/' in a key, as they can currently not be parsed, and the behavior for other properties files shouldn't change in any case. |
I don't know if that restriction still makes sense indeed. I'll let @lutter answer. |
Duplicate of #176 |
I think it's wrong to mark this as duplicate. The situation is different here:
So while I understand that just accepting the Also I can't see why compatiblity is an issue here. The change would just allow more values to be parsed, so for all applications that currently don't experience syntax errors this would not change anything. |
Ah you're right sorry. I'll reopen. |
So, unless we can lift the "no slash in key" restriction, the other option is to turn this into a seq lens, but that's kind of ugly:
This would break compatibility (and make the lens quite more complex). |
Yes, that would be an option, but I would of course prefer the compatible and clean way. |
The restriction is in the type checker, which makes it impossible to write lenses whose keys accept a slash: https://github.com/hercules-team/augeas/blob/master/src/lens.c#L586 |
Thanks for this information. So do I understand you correctly, that we now need a statement from @lutter on why this check was put in there and whether it can safely be removed? |
Yes, @lutter is the one who would know. |
Any news? |
@raphink do you know if this issue can get any progress? It seems that there is no reaction. I'd really like this issue to be resolved and would also like to help, if I can. But waiting for a specific person to respond seems non-satisfactory. Additionally, to me, this issue seems to be less a "feature-request" but more a bug, as the "feature" to parse and handle java properties-files has the bug to not parse a specific properties file correctly. So this is probably a "bug" in the java properties file lens that we try to solve with a "feature request" in the augeas core. |
Can we do something to move this issue forward? Having this lingering around without any progress is really unsatisfactory. |
The reason that And I should have read the whole issue - yes, I think you have a point that with proper escaping this would work. |
Hi, thank you very much for answering. Proper escaping does work. The question is, if we could remove the restriction from the lens. From experiments with the "broadened" lens, it all seems to work perfectly (of course you have to escape The question is: can we remove the requirement that node names must not contain |
Off the top of my hat, changing this behavior would require the following:
|
Sorry, but I don't understand why the typechecker has to cope with escaped slashes at all. Probably I've misunderstood the architecture somehow, so just let me sum up my understanding and correct me where I am wrong: The Lenses transform a text file into a hierarchical structure of key names and values. In this structure only the escaping of the configuration-file format is important (i.e. when does a character split a property name from a value, where do values really end, etc...). In this stage there should be nothing special about the Later the augeas command language is used to modify the configuration file structure. Here proper escaping of '/' is required to correctly address the nodes, as in this language '/' has a special meaning. That the slash needs to be escaped is a feature/limitation of the "augeas command language". The node name itself can contain slashes and backslashes in any way it wants. This should not matter. So could you please explain to me, why the type checker needs to understand what slashes are escaped and what slashes aren't? |
Yes, you are absolutely right. There is no need for the typechecker to worry about embedded So I think it is fine to just remove any checks for |
The '/' is only important in translating a string containing a path expression to the internal data structure we use to match it against a tree. It has no special meaning in the lens language See hercules-team#668 for more detail
The '/' is only important in translating a string containing a path expression to the internal data structure we use to match it against a tree. It has no special meaning in the lens language See hercules-team#668 for more detail
Hi @raphink, |
… override.* expressions [networkupstools#2294] Such possibility makes augtools-1.12.0 upset (fixed since 1.13.0, see hercules-team/augeas#668 for details) Signed-off-by: Jim Klimov <jimklimov+nut@gmail.com>
This java snippet:
generates this properties-file:
however augeas fails to parse this:
The text was updated successfully, but these errors were encountered: