-
Notifications
You must be signed in to change notification settings - Fork 123
Reserved Characters in Key Names #3223
Comments
See also #2698 for discussion which character to be used for array (globbing) |
First of all, if you list Second, "used for globbing" and "used for referring to parentKey, e.g. in conditionals plugin" are not valid use cases here. These are not special meanings during unescaping. If you want to prevent a special interpretation that happens later (e.g. by a plugin or library), you either have to know that this interpretation is based on the escaped key name (which would be bad, as outlined in #2698 (comment)), or you have to ensure that the unescaped name cannot be specially interpreted. Let's take In other words, to give a reason why a character has to escaped (why it is reserved), you have to think about "What behaviour of For the characters that we actually want to make "reserved", there is a decision we have to make here. Are these characters with special meaning or actual reserved characters? In my mind, characters with special meaning are normal characters that can be used as such, but may have a special interpretation in a certain context (e.g. Reserved characters on the other hand are reserved for special contexts. They cannot be used normally and are only allowed in the special contexts, in which they have a special meaning. A character with special meaning only has to be escaped in the context, in which it has its special interpretation, if this special interpretation is not desired. Outside of this context, escaping may be allowed or disallowed, depending on our stance on unnecessary escaping (°°). A reserved character on the other hand must be escaped whenever it shall have no special meaning. This means, in the context where it has special meaning it can be escaped, to avoid the special meaning. Outside this context, it must be escaped. As an example, let's look at If we treat If we see Note: For The decision above of course also requires us to define, in which contexts can these characters, now or in future, have special meanings. There are two easy solutions here: (°) As stated in #3115, this rule makes the whole system a lot easier to understand. In an escaped (valid) key name, a backslash always escapes something. In an unescaped (valid) key name, a backslash is always literally a backslash. (°°) If we adopt a very strict stance on unnecessary escaping, it should be possible to get a 1:1 relation between escaped and unescaped key names. This of course requires more effort in validating key names and therefore will have a performance impact (whether this impact is in any way significant must be tested). |
Thank you, I added it. If you find further characters, you can simply add them to the top-post.
Yes, of course we can also use another escape character or two \ for some of these characters. But this will be more complicated for users?
I had in mind that keyAddBaseName(key, "_") will actually add E.g. @sanssecours currently actually uses
If they do not have a special meaning now, they are reserved so that we can give them a special meaning later. We cannot "reserve" or "give a special meaning" at a later point of time, as then applications might already use such characters. To make it clear: In the top post the "special meaning" and "reserved" are synonyms for the escaping engine. And I would keep them as synonyms to make escaping easier.
To make this whole escaping engine sane, I would simply assume that the special characters are always special, except when they are escaped. In particular, I would like to avoid situations where characters get special meaning if an escape character was added. This is an ugly hack and makes e.g. regex unnecessarily complicated.
Exactly. The engine cannot fully prevent from creating names with wrong meanings. So I think we should not try to do it. E.g. % in the placeholders need to have an even number of occurrences but there are exceptions. And maybe some extension of contextual values will add further exceptions.
I think our most important goal should be that the escaping is easy to understand and use. The previous escaping tried hard that every name is valid. Such goals mostly cause headache but actually do not improve the usability. If someone places \ at arbitrary places, it is okay to reject some names. But in front of special characters, \ should be always valid and take away any (future) special meaning. |
This is super confusing to me... The semantics of The semantics of Now, you want
AFAIK
It would just be a big breaking change, like the one we are doing to key names now. I think we need to distinguish two things:
The first group will be some form of reserved character, improper use of which will result in a failed The second group is entirely different. There is nothing we can do during If you really want to unify when something can have special meaning to a plugin/library, I can only see something like this working: Define some escaping rules for I recognize that this is totally different from the current approach and entirely unreasonable to implement, if we want to release 1.0 any time soon, but it is the only working approach I can see, that allows us to definitively say whether a key part has any special meaning or not. |
My hope was that we can discard this distinction to make the whole escaping easier to understand. Then If this is not possible, the minimum requirement is that it is possible to pass any string to Yes, it would break some occurrences of
It is very clear to me that we should not break 1., i.e. code that assumed every string can be passed to Another example next to SSID: fstab entries can have basically everything including /. Or the mountpoint names within Elektra. |
I see now that this once again comes done the major problem at the heart of Elektra. Everything should be coherent and well defined system, but at the same time everything should be flexible and plugins should be used as much as possible. This just can't work. The problem specifically is the phrase "meaning to Elektra". We can ensure
Why? It is all but clear to me, why this is preferable? UNIX filenames for example are not allowed to contain We are already breaking (almost) EVERY piece of code interfacing with Elektra by adding the
I would not be so sure about that. In fact I know of only one part of Elektra that truely assumes that
Not sure why that is relevant?
To create the mountpoint There might be some place that uses In short:
This is easy. But combining it with " |
Yes, but I would not call it a problem but a challenge. We want the best possible Elektra and of course sometimes contradicting goals occur.
Yes, I also see that it will not be possible to have everything. With array escaping we are already quite limited to a prefix escaping, i.e. we cannot escape other characters within the base names. But this prefix escaping might be enough. And this should be extensible to all the characters proposed above. The limitation would be that either the whole key name part is escaped or nothing at all. Of course the escaping would not be magically but applications would need to check if the meaning of the keyBaseName has been taken away or we provide a different keyUnescapedBaseName so that API users can have the string with or without prefix escaping.
It is a problem for everyone implementing a file browser. Some applications had URL encoding techniques to get / into the file names. The more modern "solution" is to use the Unicode Character 'DIVISION SLASH' (U+2215) for slashes. Furthermore, keep in mind that the whole reason for existence of Elektra is that UNIX file system semantics are not suitable for configuration. In configuration arbitrary sequences for key part names including / are commonly used and thus should be supported. E.g. in YAML / are allowed characters in key name parts and also in TOML there are "Quoted keys".
Yes, and I am super-grateful that you are doing this. I would not have been able to do this alone.
Another part is the SSIDs. This was not a synthetic example but Broadcom has implemented this for their bluetooth devices. So they rely on that they can add any base name.
Yes, very hard but also a very nice unique feature that not even UNIX had before. We can be proud of that. |
This is actually what I thought we could introduce, see below. I think all of this can be solved by introducing something similar to "quoted keys". I am going to call them literal key parts. If a key part starts with an Their unescaped form is as follows:
The escaped form is a bit different, to allow easier printing:
Now To solve the problem of "we want to add anything as a key part", we introduce: size_t keySetLiteralBaseName (Key * key, char * bytes, size_t size);
size_t keyAddLiteralBaseName (Key * key, char * bytes, size_t size); These functions accept ANY byte sequence as their To make decoding literal key part easier we could add decoding functions to the public API as well. I like this much better, because it makes it very clear when the user intends to add arbitrary things to the key name and when this is not the case. |
keySet/AddLiteralBaseName is a proposal to add a new feature. Currently we do not have a way to encode null bytes in key names. When somebody needs this, we can get back to your proposal. For now, however, we need good semantics for keyAdd/SetBaseName. As outlined very long, this ideally should be any string, as otherwise many plugins and applications will be buggy because they do not expect that some strings will not work. |
Btw. maybe it best if we meet, e.g. on Tuesday? |
This is the least important point of the proposal. It only allows zero bytes, because I don't see a reason why it wouldn't. Anyways, there already is a use case:
Apart from the fact that SSIDs have nothing to do with bluetooth, EEE 802.11 clearly defines an SSID as any byte sequence up to 32 bytes long. So either Broadcom already does some pre-processing to handle zero bytes or their code is already buggy. In any case, this is clearly a use case for encoding zero bytes in key base names. In any case I have no idea about possible future extensions to the set of special characters, but for the current set, I think the solution implemented in #3115 might work as is. If we try the scenario from #2698 (comment) in this version, the following happens: Calling If we take an invalid array element like I have not yet thought about the theoretical rules we need to make this work for future extensions, but for now I think we can leave it like this. It would be nice to have array elements without the starting character, but does it really matter? Storage plugins are free to encode arrays differently, if they have a problem with the
Tuesday is bad for me... I will send you an email. |
I meant Blueray devices (that have wifi capability).
Yes, you are right. But it is a new feature. Any string in keySetBaseName is not a new feature.
No that does not matter.
No, the most important thing is that any string can be fed to keySetBaseName, and keyBaseName returns what was fed before. With the need of start characters in arrays I can definitely (and happily) live.
Sounds like a good plan. |
After re-examining everything, I think there is only one conflict. The following to statements cannot be unified.
In our particular case. The first statement follows from the guarantees for This essentially means to keep 1, which we want to, we becomes necessary to always re-check a full unescaped key part, if you want to test a certain property. In particular, you have to check the full unescaped key part to know that it is an array index. I find this an unfortunate situation, but it seems unavoidable. This also means that we could still do the whole "escaped key parts consisting entirely of digits are array indices" thing. The side effect would be that in the SSID example |
Actually 2. is not necessarily needed. We can also store a 3rd string which contains the basename to be returned (maybe only then when it is actually needed to not waste too much memory).
This is not good, we also need to somehow come to an end with this. Maybe the 3rd string will rescue us, we can optimize this later (if it is needed). Either we make a full list of prioritized requirements in a decision or we meet? The decision will be handy anyway so that people later will understand why we did it like this and which requirements we sacrificed for other requirements. |
Like I said, it was a proposal. It would be nice to have, but unfortunately it doesn't work.
We'd need to store a whole 3rd version of the key name, otherwise Right now there are not many properties a key part can have. At least not properties that are interesting across all of Elektra. "Is it an array index part?" is in fact the only one I can think of. If in future we have more properties (e.g. if we add the concept of "contextual placeholders" to the core), we can think about optimizations.
I know, which is exactly why I said I won't do it in #3115. If we decide we need it, I'll open another PR. This second PR will be a lot of work and it will be a breaking change. However, it should be a much smaller breaking change and (most) other simultaneous PRs shouldn't be affected as much as they will when we merge #3115.
I will write documentation, including a decision, when the code of #3115 is done. The open question right now are:
My suggested answers are:
Slightly unrelated thing: It might be possible to turn |
This is what this issue basically is about: to collect characters which potentially have a special meaning (now or reserved).
Yes, always be allowed.
This heavily depends on which properties of base names we lose. From user perspective it is "nice" if no
And to change the globbing to
I do not think it is a big issue: numbers within a string are also quite easy to spot:
If correctly implemented we do not need to worry also if implemented as plugin, the plugin could escape already present __directoryvalue. My dream is that keySetBaseName would escape _directoryvalue (one underscore or @ would be enough), but the directoryvalue plugin would use keyAddName to get a raw _directoryvalue inside the key name. (Which would be protected because underscore or @ is a reserved character not to be used for applications). |
Hopefully we can discuss this today, I hope this way we can come easier to conclusion. |
As I said, we shouldn't loose anything compared to the current state of #3115, but we also wouldn't necessarily gain a lot. The main question is how much more work do we want to invest into the key name change. Lets talk about this today.
This might just be me, but I didn't spot the
See #3256 for an alternative solution using metakeys.
I am strongly against that. The core should not be concerned in any way with what plugins do, or what requirements they have. It also sets a bad precedent. What if another plugin uses |
Outcome of talk:
|
The current behaviour (in #3115) of libelektra/src/libs/elektra/keyname.c Lines 1360 to 1462 in 9e91654
We only escape when it is needed to avoid unnecessary escaping in the escaped name. Also since you asked, if there is a 1:1 relation between escaped and unescaped key name: No, there is not. We decided to allow unnecessary escaping:
This means that e.g. If we want to ensure a 1:1 relation, we could either say that escaping is only allowed when required (don't like that), or remove unnecessary backslashes during the canonicalization step. Personally, I don't think the 1:1 relation is required. We only need a n:1 relation to make |
Thank you for investigating the round-trip behavior. Yes, the lookup is not a big deal (it is already 1:n because of cascading) but that keys with different names remove themselves when appending them to the keyset is ugly. And of course that it does not round-trip is another important goal: Every KeySet should after serializing and serializing be exactly the same, and this would not be given if Do you maybe have a solution to the ksAppend and round-tripping problem? |
Its a matter of definition. What uniquely identifies a key? The technical answer is the unescaped name. It is what a KeySet uses to differentiate between keys. If you still want the 1:1 relation, escaping must only be allowed when necessary. That is not more effort to implement, but might be annoying to users. |
Until now saying "the name identifies a key" was enough because there was 1:1 between escaped and unescaped. They were only stored both as performance improvement. (space vs. time) I would prefer if it can stay this way.
Why would it be annoying? My idea of If they now have the same unescaped name, we can simply reject |
That example does not demonstrate anything. Obviously Arrays are also a bad example, because we said If the escaped part is This is what I meant with:
To which you replied:
Which I interpreted as both Anyways...
The choice can be made independently for each of the reserved characters. Only one of these options can be chosen per character to retain the 1:1 relation. In #3115 it is currently option 1 for |
I updated the behavior of YAML CPP and the Directory Value plugin in PR 3357. The pull request also updates part of the documentation to take the mandatory |
I have now updated the proposal in #3447. I hope it is now easier to understand (it is still very long). |
@markus2330 I'm gonna put this here even though the previous discussion was in #3223, because I think it fits better. I just discovered/remembered that in the current version of Elektra [1], it's already the case (and implemented that way) that "any ESCAPED Key Name part that start with @bauhaus93 This might help you when you implement and metadata in For those that haven't read the proposal, the idea would essentially be (for JSON): {
"key": {
"@value": "127.0.0.1",
"sub": "xyz",
"@meta": {
"check/ipaddr": "ipv4"
}
} Turns into two keys:
and
[1] |
Sorry for the confusion, but I had to clarify parts of the comment above. The part about the However, since it has always been a reserved name and we will require escaping in #3447, I think it is still fair to use it in a storage plugin. IMO a user should not expect that a reserved name can always be used without issues. But of course we will need to take some precautions. One possibility would be this (JSON again): {
"key": {
"@value": "127.0.0.1",
"@sub": "xyz",
"@meta": {
"check/ipaddr": "ipv4"
}
} Turns into two keys (note the
But this {
"key": {
"@@value": "127.0.0.1",
"@@sub": "xyz",
"@@@sub": "abc",
"@@meta": {
"check/ipaddr": "ipv4"
}
} Turns into (again
The rules here would be:
(Note: |
I do not understand the aim of the last two comments, is this a proposal about the directoryvalue plugin replacement?
For |
The Like I said, you need to impose restrictions to fit metadata into JSON (AFAIK the same goes for TOML). So yes, my proposal in the comments above does impose a restriction on the JSON files, but applications that use
Not sure how the On the current
I also don't remember, why I made this change. There probably was a good reason, but in any case it is done now and I don't think changing back would be easy. [1] As always, the problem here is that Elektra wants to do everything and please everyone. On the one hand we want to allow storage plugins that can read arbitrary files in a standard format (e.g. JSON) and turn them into KeySets. On the other hand we want to allow applications to use arbitrary strings as a part of a key name. This might work for some time, but at least when you get to metadata it breaks for certain formats. JSON is a single tree with values only at the leaf nodes. KeySets are a tree with values at every node, and some of the node have a link to whole separate tree as well. You might be able to convert between the two, but one of them must impose limitations on the other to have a lossless conversion. |
@kodebach does this mean you are in favour of restricting the formats s.t. metadata can be stored? I never stumbled upon this, because I mostly used dump and then mmapstorage and only rarely imported/exported configs using other plugins. This is quite unfortunate. As a user I would rather be able to import/export to standard spec (losing metadata) while storing the real data (incl. metadata) using an arbitrary elektra internal format. I think restricting the format could be confusing to users. For example, if Elektra provides a non-experimental JSON plugin, then I would expect it to be able to handle arbitrary spec-conforming inputs. It's unclear to me how the user would be able to check that his config files are conforming to the restricted spec. @markus2330 what do you think about imposing restrictions on the format? EDIT: I agree that "Elektra wants to do everything and please everyone" is a problem. |
We need to define our priorities. What exactly is an absolute must, and where can things change. As it is right now, the only way for many formats is to store metadata in comments (@bauhaus93 did that in #3500 for TOML). IMO this is not a solution, but merely a clunky work around. The worst part is that is abuses the one part that should never be touched by a parser and can drastically affect the readability of a storage file. Some formats (namely JSON) also do not have comments. Very basic restrictions we could impose (using JSON as an example again) would be that all files must look like this: {
"kdb": {
"elektra": {
"version": 1
}
},
"meta": {
"elektra/version": {
"type": "long"
}
}
} Other "restrictions" include interpreting certain key names like The Instead of a two JSON objects we could also use separate files. But that would need support from at least the resolver and maybe even the backend code/plugin. Separate files would make it possible to import standard JSON files, without any metadata. How non-leaf keys with values would be handled in this case is not clear.
I agree, but importing/exporting everything goes a bit against the mountpoint idea of Elektra. I already know, nobody wants to implement this, but there is a very general solution: If a mountpoint uses a storage plugin that doesn't not support all of Elektra's features, the backend plugin creates a secondary fallback storage file in a format that does support all features (e.g.
Definitely. But it is clear to me that currently Elektra allows to much and something has to be restricted. Even the solution with multiple files requires some kind of restriction to config file names to avoid collisions. Originally I thought the easiest solution would be to restrict Elektra's Key Names, since that is the part we have the most authority over. But apparently there are applications that use WiFi SSIDs [1] directly as a Key Name Part, so that doesn't work. At least not without huge effort, as my proposal showed...
And that seems to be enough for people. All of the file systems listed on Wikipedia (except the ones without directories) have some kind of restriction on the filenames. I want to stress again: All of this boils down to the fact that we have taken "Key Name Parts are arbitrary sequences of non-zero bytes" as an axiom [2]. Changing this would be every easy and it would fix everything. It could even be a tiny restriction e.g. "Key Name Parts are arbitrary sequences of non-zero bytes, except those that both start with Sorry, if this seems like a rant, but at some point it just gets really frustrating that everyone agrees there is a problem, but every solution is deemed to have a flaw or is seen as too complicated. [1] According to Wikipedia until the 802.11-2012 a WiFi SSID was "zero to 32 octets (32 bytes) long" including zero-bytes and "Wireless network stacks must still be prepared to handle arbitrary values in the SSID field", even though SSIDs must now be valid UTF-8. So just [2] That is actually, why the new documentation in #3447 starts with Key Name Parts. It is easiest (and IMO the most logical) to explain the current Key Names by starting with Key Name Parts and going from there. But the old way of
shows a lot better how insanely complex and complicated Key Names are. [3] In case you are wondering, yes #3447 imposes some new restrictions, but those are useless, because they do not affect the Unescaped Key Name (except for the namespace) in any way. |
We discussed this regarding the cache implementation and decided against it. The current implementation of the resolver has stronger consistency guarantees than can be achieved when using two files. The resolver uses the atomic
True.
I agree, this is the part where restrictions make the most sense. As you've said, filenames are quite restricted and it still works really well. Unless anyone knows a good reason not to restrict Key names (maybe @markus2330)?
No, and thank you for discussing this. Unless @markus2330 knows some reasons why we can not change this, I am fully open to your suggestion (like restricting |
That is a good reason, against multiple files yes...
More realistically we could impose the restriction: "A Key Name must not contain the Key Name Part Personally, I think we should leave room for the future, but if restricting all Key Names is too much, we could also restrict what |
Thank you very much for these valuable discussions. I started #3514 to summarize the important decisions scattered around everywhere. Please prefer to directly comment on the text in #3514, so that we can come to conclusions.
I do not think anymore that it should be our goal to circumvent restrictions of file formats. If JSON does not support meta-data and non-leaf values, Elektra with a JSON file mounted, simply forwards its restrictions on KeySets. We can document them, like proposed in #3504 and the storage plugins should fail on such KeySets but nothing more. (Of course someone can come up with a super-JSON file format with less restrictions but this is beyond our current man power and as such irrelevant.)
Who knows?
Sounds good.
Yes, we need to drop the idea that any format can support anything.
I think that most applications will not be very demanding anyway (e.g. only have leaf-values and do not need any meta-data except of type), so all we discuss here is only relevant to exceptional applications. For these applications, I think it is best that application developers develop their own storage plugins or they use our best storage plugins, which support such things.
It is not a good idea. We should support configuration file formats as standardized. It can be a big problem if some valid JSON/XML files get rejected by Elektra. But on the other hand, we do not need to support anything more than standardized. To try this was a mistake from the past (trying to please anybody).
doc/GOALS.md in #3514
I agree it is not the best idea, it already had plenty of problems in the
See below.
This is the "portable Filename Character Set" and I doubt that there is any file system in use anymore which only supports this. In my experience any interpretation of the file names only calls for trouble (e.g. JFS had such features).
For Elektra's source it nearly is #1615 😉 But real applications immediately wanted more... (e.g. spaces, umlauts, ....)
It is not as simple as that: it makes storage plugins much more complicated. It simply moves logic to other places.
This idea is similar to
But for what feature exactly do you think we need it? I think we should rather forget about these features and properly use meta-data to give semantics to keys.
My point is: maybe we do not need a solution because the problem does not exist.
Can they still have null-characters? Btw. I came up with the SSID example because this was a real requirement of a real customer (broadcom). Null-characters were not required, it is obvious that a
Yes, but better they are like this than to have such logic in every application and storage plugin.
Yes, the key name can have any restrictions. There always was the restriction of dangling escape, so a few more restrictions do not matter. #3447 will be a huge improvement for Elektra.
It can be done by writing a journal log where you write everything you plan to do and in case of any problems you can recover by replaying the journal. To implement this is very much beyond our man power. It also does not really fit to a configuration system (nor file systems), it is a technique for structured databases. I made it a non-goal in multiple_file_backends.md 59066aa
We can enforce the restriction of |
Thereby defeating one of the main benefits of Elektra: "The admin/user decides the config format not the application developer".
That was never my suggestion. Of course we should accept every valid JSON. The question is what
They still don't allow
I do not agree. Storage plugins are already extremely complex, relatively speaking this would only be a minor inconvenience. (assuming we provide a good
Both Also both are much more powerful than what I proposed. My proposal would only "escape" a full key name part at a time.
You just said, that some storage plugins might not support metadata. So it seems this is not an option.
Of course, if you just change your mind and say a storage format can limit Elektra's abilities the problem goes away. But that fundamentally changes Elektra's promise to users. We would limit all users just to allow some developer to safe a few lines of code dealing with encoding special values.
Probably, NUL is a valid UTF-8 character.
Well, the maximum size of an SSID is 32 bytes, so you don't have to pass the size arround, as long as the buffer is always 32 bytes and zero-padded.
Please make up your mind. This whole time you have argued that there cannot be any restrictions.
"Dangling escape" is not a restriction. It is a syntax error in the escaped key name. Escaped key names never were arbitrary strings. This is a totally different thing.
We could require a flag in
I don't want to restrict what applications are store, but how they are storing it. This gives (storage) plugins more freedom. |
It was never possible that any storage plugin can be used for any application. This does not mean that we withdraw the power of admin/user to change mountpoints. But we need to be honest and give a big disclaimer that doing so involves some risks.
On this problem we already wasted extremely many hours in about 10 years, without any progress. The first idea was keytometa, then directoryvalue, with many steps in between. Why not accepting JSON as it is? It will work for most applications. Is a slightly better structure really worth it?
Applications even find ways to work around the absence of a configuration library. Why would they use a configuration library which gives them limitations they currently do not have? It is quite trivial to implement a property file that allows any key names with any values. Why would Elektra be of any use if it does not even deliver this?
First we need to clarify the goals before we make complex solutions.
Did you look at simpleini, ni, c or mini? You can still easily write a useful storage plugin within less than a day.
Unfortunately the assumption does not hold. We also tried to create helper libraries since many years, with very little success. What is done in the core properly always was the best solution.
No, HERE documents do not reserve any syntax. You can decide on-the-fly (e.g. based on the data) which keyword you want to use to mark the end of the document.
The proper way is to specify keys in the namespace
I separated this question to #3515
Key names aka
I was thinking of a plugin that rejects anything written to |
Yes, they do
It's fine to me, if not all plugins support everything, but if an application uses a custom storage plugin the admin/user doesn't have any choice. There should be at least some choice, even if it is just e.g. YAML or TOML. If only a custom format tailored to Elektra supports everything, then I fear no one will use Elektra. To me one of the most important features of Elektra is that a amdin/user can always use their favourite config format no matter what application.
In general INI plugins are not a good example, because INI does not really have a specification, so there are not limitations coming from the format.
But What is the more important use case?
For the first case, we need plugins that can read any file and produce useful
Yes, this is a possible solution. But it requires a lot of work to make But it causes some difficulties with metadata inferred from the storage format (e.g. type, array). Would it be an error, if we read a JSON array that has no matching However, this doesn't solve the problem for non-leaf keys with values.
These are two entirely different things. However, everything around Elektra's key names is based on a key name part (see also the docu in #3447). So the only question we need to discuss is: What is a key name part? |
I do not see how this would be even possible. In Elektra you can always implement alternatives as long this alternative yields suitable KeySets for the application. The only thing fixed is the KeySet but how the KeySet is produced is always something interchangeable. For me this is the main benefit of Elektra. That is why the KeySet (including the key names) are the most important (and most difficult) decisions of all.
I do not see how any of the decisions we are talking about effects the possibility. If you put enough effort into a storage plugin for your favorite config format (including syntactical extensions or similar) you will be able to get any application running.
For most applications these restrictions are irrelevant. One tool I use works with simpleini and also mini as backends. I think we landed already nearly at the same conclusion: That whatever happens to yield the correct KeySet, need to happen within the storage plugin. Using a "storage library" is of course advantageous but in the end it is an implementation detail. The idea that "later plugins fix what the storage plugin made wrong" failed. So why do we need further syntax in the key name? Whatever syntax is needed can be eliminated within the storage plugin.
Imho "1." is more important now, as we need this for KDE. So we somehow need Elektra in a shape to not destroy the About "2." I do not know what "fits best for Elektra" means. Elektra has no purpose for itself, its only purpose is to serve the needs of developers, users and admins.
No, only the other way is an error: if the spec requires an array but there is none.
Yes, I totally agree. And something needs to be done with
You argued that this is not important anyway 😜 And I agree, for nearly all applications it will not be important.
Can you make an issue that lists the open/unclear points? Or even better: add it to #3514? |
I should have added more context to my response. I think we are on the page in this regard. My comment was in response to this statement from you:
In particular the part: "I think it is best that application developers develop their own storage plugins" While this will always be an option, I think it should never be something we recommend or even suggest as a solution. Using a custom storage plugin would not be in line with Elektra's philosophy and should be avoided as far as possible. Note: by "custom storage plugin" I mean a plugin that is designed to work with a specific application but makes no guarantees to be compatible with the rest of Elektra. It would be totally okay, if someone wants to use a custom format and develops a corresponding plugin that is compatible with the standard Elektra environment.
Yes, that is basically it. The storage plugin cannot rely on other plugins (except maybe binary values and such things). Although maybe a plugin is actually the solution after all. I'll have to think about it further and will post the idea, if I think it works.
Let's go a step further. What if we have this JSON As this is an edge case, we might just say: This is unfortunate, but it is what it is.
The same can be said about using arbitrary key names. Nearly all applications wouldn't have a problem, if they can't use
I will make a list somewhere, so we can discuss it on Monday. |
I was actually thinking along these lines. But yes, particularities easily creep in. E.g. the @mpranj did you check already if this actually works? At least
At the moment I would prefer if we fix the things where we already know how to fix them.
Exactly, if you want "feature X" you cannot have a plugin without this feature in the import/export chain. The same with comments and so on.
Yes. But there is also a big difference between something that does not work with some plugins and something that will never work at all with Elektra.
👍 |
I get your point, but realistically how often will not having
The idea was a plugin that is always mounted and does some encoding/decoding of key names. Then a storage plugin only has to deal with The effect would be a small limitation on storage files, but no limitation for applications. The complexity of storage plugins would also be unaffected, because the storage plugin doesn't have to use any |
Probably no problem at all. But it will be a problem now as much as it will be later. So why reserve it now and not when we really find a use case where something like this is needed? Then we know it is not only a fantasy and can choose an appropriate name. In programming languages we (usually) only reserve key words when we actually do syntactical extensions.
For metadata on keys, spec is the better solution as it refers to all namespaces. Non-spec metadata is basically only useful formatting preserving and similar.
It is not that a storage plugin uses any name, the question is the behavior if it encounters |
Because this is a huge breaking change and before 1.0 is the right moment to do such things. Especially since are already changing key names. There also is a very real use-case for it right now. At the very least, it allows storing non-leaf keys with values in any format.
I'll just mention It would be nice, if metadata was only stored in
If the plugin uses |
As promised in #3223 (comment), I now added #3517. |
It only works with
Are there some changes needed which are not yet in the issue tracker? I think it is a must-have for 1.0 that at least the basics of spec work well (and to get rid of the not-working stuff). |
But how? You need the
It's impossible to say. We need to decide what spec should actually do. Then we need to find out, if and how that is possible. Even then it is very likely that we find some edge cases that don't work. Elektra is just so complicated that it is nearly impossible reason about and good test coverage is at least as hard. A lot of Elektra is also still based on loosely or not at all defined principles. The biggest problem are definitely the current plugin positions. But those will take a lot of work to fix. IMO that part essentially needs a complete redesign. |
Yes, spec would really need to understand the semantics of the metadata, like arrays. So it would check all namespaces how the array actually looks like, and then add the proper metadata
I agree, so let it make more simple. Now is the perfect opportunity. We learned a lot about what cannot be done. So let us get rid of that stuff.
I am more and more agreeing with @mpranj that hooks for specific global plugins is not such a bad idea. The requirements for such plugins are quite complicated and thus generic positioning would become too complicated. So we simply would not have any generic global plugin positions but only ones specific for mmap, spec and notification (the only one we really need for 1.0). Generic positions would be nice, but it is clearly beyond our capacity to test this. I modified the decision in 89b2903 Further discussions please in #3514 |
I propose following characters to be reserved and escapable (to remove special meaning) within key names:
What do you think?
The text was updated successfully, but these errors were encountered: