Skip to content

Elektra backend threeway merge#19

Open
markus2330 wants to merge 33 commits intomasterfrom
elektra-backend-threeway-merge
Open

Elektra backend threeway merge#19
markus2330 wants to merge 33 commits intomasterfrom
elektra-backend-threeway-merge

Conversation

@markus2330
Copy link
Copy Markdown
Contributor

No description provided.

@markus2330
Copy link
Copy Markdown
Contributor Author

@Chemin1 can you help out here and fix this code to use your API?

@dominicjaeger
Copy link
Copy Markdown

I think so but I still have to solve some dependency problems (#20) to compile this repository.

@dominicjaeger
Copy link
Copy Markdown

This patch can be applied on this branch elektra-backend-threeway-merge and replaces the old merge tool with the new merge library. Unfortunately, this is not tested in any way as I am still unable to compile kconfig #22.

@markus2330
Copy link
Copy Markdown
Contributor Author

@FelixResch please try not to keep important PRs open too long as this hinders others to successfully work with the master of this repo.

What is the status here? Can you please rebase?

@FelixResch FelixResch force-pushed the elektra-backend-threeway-merge branch from 1e8d223 to 2119d81 Compare April 1, 2020 16:41
@FelixResch
Copy link
Copy Markdown
Collaborator

I have now rebased the branch on upstream/master and applied @Chemin1's patch. I had to change the root key in some places, but now it works. (At least my test runs successfully)

I just have one question: The problem was, that when any keySet for the merge is given with a name space, but the corresponding root key does not contain any namespace, the namespace is added to the name of the keys, after resultRoot and before the rest of the key name. I think this happens, because the method used for removing the root only removes the name of the root key and leaves the namespace in, if the root does not contain one. Is this desired behavior?

@markus2330
Copy link
Copy Markdown
Contributor Author

Cool! 🎆

About the question: can you give an example or even test case for this behavior?

@FelixResch
Copy link
Copy Markdown
Collaborator

A simple example:

Assume mergeKey to be /sw/example/... and base, ours and theirs to be keySets with keys from arbitrary namespace, e.g. user/sw/example/.../*. If you now call elektraMerge (KeySet * our, Key * ourRoot, KeySet * their, Key * theirRoot, KeySet * base, Key * baseRoot, Key * resultRoot, int strategy, Key * informationKey) with mergeKey as every root and the respective keySets the merged keys will look like this: /sw/example/...user/* with the namespace in the middle of the key name.

When I change the roots, to contain the same namespace as the respective key set, the merge works as expected.

I expected the merge to handle namespaces transparently. Is it expected behavior that effectively only merges with explicit namespaces are possible? Even then I wouldn't expect the namespace to appear in the middle of the key name...

@markus2330
Copy link
Copy Markdown
Contributor Author

This sounds very much like a bug for me. In the merged keyset there never should be a key name which was neither in our, theirs or base before. @Chemin1 can you please look at cascading merges?

As workaround I would for now use only keys of user/, which used to be the default behavior of KDE anyway (copying system config to user config and then only operate on user configs).

@dominicjaeger
Copy link
Copy Markdown

dominicjaeger commented Apr 5, 2020

When I change the roots, to contain the same namespace as the respective key set, the merge works as expected.

IIRC, that is what I had in mind when initially (that was when I had 0 knowledge about namespaces) wrote this. The root should sort of indicate where the merge starts. Please try something like this: If you have a KeySet containing

user/sw/example/a
user/sw/example/b
user/sw/example/c

to set rootKey to user/sw or user/sw/example depending on from where you want to merge.

@markus2330
Copy link
Copy Markdown
Contributor Author

Thank you for the tip but we should also fix the issue with cascading keys as root key.See ElektraInitiative/libelektra#2762 and ElektraInitiative/libelektra#1288 why it is important.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants