-
Notifications
You must be signed in to change notification settings - Fork 123
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good: please concentrate now on rebasing, fixing build errors and docu. Other features can be added later in separated PRs (simply document limitations in the README.md)
src/plugins/toml/README.md
Outdated
* Can't associate those info to array top key in the way like file ending comments are preserved | ||
* Maybe add own metakey (eg. epilogue/comment/#1)? | ||
|
||
## TODOs |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This TODOs are enough, no duplication of TODOs in the PR description are needed.
src/plugins/toml/README.md
Outdated
|
||
- Don't know where/how exactly to store trailing array comments/newline info | ||
* Can't associate those info to array top key in the way like file ending comments are preserved | ||
* Maybe add own metakey (eg. epilogue/comment/#1)? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you give an example for the problem in an issue? Usually we collect meta-data not belonging to a specific key in the parentKey. Maybe you can simply add comment/#
there? Please do not forget to document this, so that we do not get a mess with different behaviors between plugins.
src/plugins/toml/README.md
Outdated
## TODOs | ||
- Document functions | ||
- proper sorting -> arrays | ||
- base64 for binary k/v |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be simply adding the base64 plugin in infos/needs
src/plugins/toml/error.c
Outdated
ELEKTRA_SET_INTERNAL_ERROR (root, msg); | ||
break; | ||
case ERROR_MEMORY: | ||
ELEKTRA_SET_OUT_OF_MEMORY_ERROR (root, msg); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In master this takes only one argument, please rebase.
src/plugins/toml/table_array.c
Outdated
snprintf (fraction, fracSize, "%s/%s", baseName, fracDup); | ||
elektraFree (fracDup); | ||
keyAddName (childDup, ".."); | ||
} while (keyRel (parent, childDup) != 0); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
keyRel was removed, use keyIs(Direct)Below.
src/plugins/toml/testmod_toml.c
Outdated
|
||
static void testWriteReadBoolean (void) | ||
{ | ||
// can't check without active type plugin, must check how to add plugin dependency to tests |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add TODO
@sanssecours can you give some feedback about the parsing? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@sanssecours can you give some feedback about the parsing?
I added some comment. However, since this PR is still pretty much a work in progress I stopped the review process for now. I do not think it makes much sense to comment on a pull request that might be updated any time. Overall the stuff I have seen looks good though 😊.
src/plugins/toml/scalar.c
Outdated
case SCALAR_STRING_BARE: | ||
return elektraStrDup (scalar->str); | ||
default: | ||
ELEKTRA_ASSERT (0, "All possible scalar enums must be handeled, but got into default branch"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ELEKTRA_ASSERT (0, "All possible scalar enums must be handeled, but got into default branch"); | |
ELEKTRA_ASSERT (0, "All possible scalar enums must be handled, but got into default branch"); |
src/plugins/toml/README.md
Outdated
|
||
# TODO: Documentation | ||
|
||
## NULL keys |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It might make sense to use the null
plugin to store these types of key values instead.
fa25438
to
5f2d4d1
Compare
@@ -1295,3 +1295,14 @@ status = implemented | |||
usedby/plugins = cache | |||
type = boolean | |||
description = tells the cache plugin to remove all cache files during the next `kdbGet` in a safe way. | |||
|
|||
[tomltype] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would prefer if it is directly integrated in the types of Elektra (type, enum, array) and only for the tables there is some internal/toml/type or we even add the "tables" to standardtypes. I would prefer the name "section" though (similar to array as extra meta-data).
@bauhaus93 It would be great if we can finally go towards merging this. Once the build-server says it is okay, we can merge it (at least as experimental plugin). |
b293494
to
434ed50
Compare
src/plugins/toml/node.c
Outdated
@@ -110,6 +112,9 @@ void destroyTree (Node * node) | |||
{ | |||
if (node != NULL) | |||
{ | |||
if (node->type == NT_LIST_ELEMENT) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Formatting
125fd38
to
4e8ec78
Compare
3bec983
to
e41479e
Compare
@bauhaus93 how is the toml plugin progressing? Regarding the build failures it seems that some problems should vanish if you rebase, but seems like there are some memleaks. |
@bauhaus93 how is the TOML plugin doing? I closed now bugs related to INI as TOML will replace it. |
@markus2330 I tried to track down the remaining memory leak(s), but I couldn't figure out where exactly they reside. The leaks do not appear with valgrind, but only with ASAN. If I compile with It seems to me, that the leaks happen exactly once for each test case/invocation of the parser:
Even if I let the lexer drop every read char or modify the parser to not match anything, the leaks persist. They disappear only, when not calling |
@sanssecours can we maybe blacklist these leaks? Did you have similar experiences? |
As far as I remember, no. However, I did not use Flex and only used the C++ interface of Bison, which makes handling of dynamic memory much easier, since you can just use RAII.
We probably can, but I think it would make sense to check if these memory problems show up with a very simple parsing example that uses Flex and Bison beforehand. |
@bauhaus93 can you please rebase and push again? It's weird but it seems that we are missing debug symbols for some packages. Maybe we get more output this time. |
Great to see activity here 💖 |
@bauhaus93 thank you for rebasing. Unfortunately it seems the issue was not fixed. From the addresses of the backtrace I would guess its inside libc. I took the liberty to add the corresponding debug symbols on top of your branch. I hope we will see what's going on now. |
@bauhaus93 unfortunately we were still missing the correct debug symbols. I now added a fedora 32 asan build in #3434 with bison and flex debug symbols among others. Can you please pull and rebase again. |
Thank you for rebasing again. The fedora 32 GCC asan build failed as well with apparently the same problems. Debug symbols for libc, bison, flex are definitely available. Is it possible it uses another lib? If you find the correct lib please add debug symbols to the fedora 32 docker image until we find the underlying problem. Debug symbols can be added in the section below |
The plugin now fills in missing comment metakeys (start/spaces) when writing. Previously, if a comment was created via kdb meta-set, it would miss the start and space metakeys, resulting in the comment written without it's starting symbol, creating invalid TOML files. Fixed an infinte loop, which occurec when the root key was in the keyset. Fixed a test case, which didn't test file ending comments properly. Added some doc for comments.
Great to see an update here! 💖 |
@markus2330 I've also contacted the author of the page from which I took the UTF-8 samples and he said I may use the collection. Could there be an issue with the single texts themselves? They mostly are poems/texts 100+ years old. I've also removed the directory value plugin from the needed plugins for now, otherwise there's a problem on writing (the I've got a question about the build servers: Some of them (eg the FreeBSD ones) exclude the plugin from being built, because flex is missing. Where can I add this dependency? I couldn't find related Dockerfiles in the |
Thank you for asking! ❤️ If the author we took it from said it is okay, then we assume that he/she checked. If the text is old enough, the copyright expired anyway and it is public domain (okay to use for us).
Thank you 👍
It is probably .cirrus.yml for BSD or .travis.yml (both in the root directory as these CIs do not allow the files to be located anywhere else). |
Adds the path of flex to the cmake paths, when on apple and using homebrew.
Dockerfile now installs flex and bison.
It finally passes the CI! I think we can merge it as this PR is already very long and it will be easier if new changes come in a new PR. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is definitely ready to be merged if you ask me. Minor things can always be polished/fixed, and this looks great to me as-is.
Good work @bauhaus93! Ping me if you agree with the merge and remove the draft status.
Fixes ElektraInitiative#3474 The problem was, that when having comments associated to table array declarations in a TOML file, the table element root key (eg. tablearray/#0), which normally is not emitted in the keyset, has to be added to it. This caused trouble in the building of the file tree for writing. Fixed the table array index loop, to handle the element root key appropriatly.
Co-authored-by: Mihael Pranjić <[email protected]>
Co-authored-by: Mihael Pranjić <[email protected]>
@mpranj Yeah, I think it's ready to merge if the tests pass now. I just fixed the issue with tablearrays @markus2330 pointed out, and if this didn't cause any new problems, it should be fine. |
@bauhaus93 thank you so much! It's great to finally have this merged so everyone can test it. Can you open a new PR where |
@mpranj Yeah, nice it's finally merged. Yes, I'll create a PR for that. |
How would I set toml as the default storage plugin for checking? |
In scripts/cmake/ElektraCache.cmake line 137 you can change KDB_DEFAULT_STORAGE to toml. |
const Key * findMetaKey (Key * key, const char * metakeyName) | ||
{ | ||
keyRewindMeta (key); | ||
for (const Key * meta = keyNextMeta (key); meta != NULL; meta = keyNextMeta (key)) | ||
{ | ||
if (elektraStrCmp (keyName (meta), metakeyName) == 0) | ||
{ | ||
return meta; | ||
} | ||
} | ||
return NULL; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@bauhaus93 Any particular reason, why you didn't just use keyGetMeta
instead of looping through all metakeys?
Just asking, because it just caused me some confusing while rebasing #3447.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, there wasn't any. I just somehow missed the existence of keyGetMeta
. I'll replace all findMetaKey
occurences with keyGetMeta
, which does exactly what I want. Thanks for the hint!
Basics
These points need to be fulfilled for every PR:
(added as entry in
doc/news/_preparation_next_release.md
whichcontains
_(my name)_
)Please always add something to the release notes.
(first line should have
module: short statement
syntax)close #X
, are in the commit messages.If you have any troubles fulfilling these criteria, please write
about the trouble as comment in the PR. We will help you.
But we cannot accept PRs that do not fulfill the basics.
Checklist
Check relevant points but please do not remove entries.
For docu fixes, spell checking, and similar none of these points below
need to be checked.
(not in the PR description)
Review
Reviewers will usually check the following:
Labels
If you are already Elektra developer:
say that everything is ready to be merged.