Skip to content
This repository has been archived by the owner on Oct 15, 2024. It is now read-only.

Checkconf (2nd attempt) #733

Merged
merged 24 commits into from
Jun 15, 2016
Merged

Conversation

petermax2
Copy link
Member

@petermax2 petermax2 commented May 18, 2016

TODO

  • pass backend config to checkconf
  • test cases for modified backend conf
  • implement setConfig() for BackendBuilder
  • test case for removing key from plugin config
  • simplify unit tests

See #559 and #725 .

@markus2330
Copy link
Contributor

markus2330 commented May 18, 2016

Strange, that is an error I had fixed before.

Did you rebase to the latest version?

Or did the build server merge incorrectly?

@petermax2
Copy link
Member Author

petermax2 commented May 18, 2016

On my Fedora CMake fails with similar error messages.

@petermax2
Copy link
Member Author

I rebased to the latest version.

@petermax2
Copy link
Member Author

Something is still wrong:

../plugins/ni/CMakeFiles/elektra-ni-objects.dir/nickel-1.1.0/src/io.c.o: In function `GetNextIdentifier':
/home/pnirschl/Projekte/libelektra/src/plugins/ni/nickel-1.1.0/src/io.c:93: multiple definition of `GetNextIdentifier'
CMakeFiles/testmod_ni.dir/ni/nickel-1.1.0/src/io.c.o:/home/pnirschl/Projekte/libelektra/src/plugins/ni/nickel-1.1.0/src/io.c:93: first defined here
../plugins/ni/CMakeFiles/elektra-ni-objects.dir/nickel-1.1.0/src/io.c.o: In function `GetValue':
/home/pnirschl/Projekte/libelektra/src/plugins/ni/nickel-1.1.0/src/io.c:413: multiple definition of `GetValue'
CMakeFiles/testmod_ni.dir/ni/nickel-1.1.0/src/io.c.o:/home/pnirschl/Projekte/libelektra/src/plugins/ni/nickel-1.1.0/src/io.c:413: first defined here
../plugins/ni/CMakeFiles/elektra-ni-objects.dir/nickel-1.1.0/src/io.c.o: In function `PutSection':
/home/pnirschl/Projekte/libelektra/src/plugins/ni/nickel-1.1.0/src/io.c:620: multiple definition of `PutSection'
CMakeFiles/testmod_ni.dir/ni/nickel-1.1.0/src/io.c.o:/home/pnirschl/Projekte/libelektra/src/plugins/ni/nickel-1.1.0/src/io.c:620: first defined here
../plugins/ni/CMakeFiles/elektra-ni-objects.dir/nickel-1.1.0/src/io.c.o: In function `PutEntry':
/home/pnirschl/Projekte/libelektra/src/plugins/ni/nickel-1.1.0/src/io.c:664: multiple definition of `PutEntry'
CMakeFiles/testmod_ni.dir/ni/nickel-1.1.0/src/io.c.o:/home/pnirschl/Projekte/libelektra/src/plugins/ni/nickel-1.1.0/src/io.c:664: first defined here
../plugins/ni/CMakeFiles/elektra-ni-objects.dir/nickel-1.1.0/src/nickel.c.o: In function `Ni_GetVersion':
/home/pnirschl/Projekte/libelektra/src/plugins/ni/nickel-1.1.0/src/nickel.c:90: multiple definition of `Ni_GetVersion'
CMakeFiles/testmod_ni.dir/ni/nickel-1.1.0/src/nickel.c.o:/home/pnirschl/Projekte/libelektra/src/plugins/ni/nickel-1.1.0/src/nickel.c:90: first defined here
../plugins/ni/CMakeFiles/elektra-ni-objects.dir/nickel-1.1.0/src/nickel.c.o: In function `Ni_New':
/home/pnirschl/Projekte/libelektra/src/plugins/ni/nickel-1.1.0/src/nickel.c:100: multiple definition of `Ni_New'
CMakeFiles/testmod_ni.dir/ni/nickel-1.1.0/src/nickel.c.o:/home/pnirschl/Projekte/libelektra/src/plugins/ni/nickel-1.1.0/src/nickel.c:100: first defined here
../plugins/ni/CMakeFiles/elektra-ni-objects.dir/nickel-1.1.0/src/nickel.c.o: In function `Ni_Free':
/home/pnirschl/Projekte/libelektra/src/plugins/ni/nickel-1.1.0/src/nickel.c:121: multiple definition of `Ni_Free'
CMakeFiles/testmod_ni.dir/ni/nickel-1.1.0/src/nickel.c.o:/home/pnirschl/Projekte/libelektra/src/plugins/ni/nickel-1.1.0/src/nickel.c:121: first defined here
../plugins/ni/CMakeFiles/elektra-ni-objects.dir/nickel-1.1.0/src/nickel.c.o: In function `Ni_GetName':
/home/pnirschl/Projekte/libelektra/src/plugins/ni/nickel-1.1.0/src/nickel.c:151: multiple definition of `Ni_GetName'
CMakeFiles/testmod_ni.dir/ni/nickel-1.1.0/src/nickel.c.o:/home/pnirschl/Projekte/libelektra/src/plugins/ni/nickel-1.1.0/src/nickel.c:151: first defined here
../plugins/ni/CMakeFiles/elektra-ni-objects.dir/nickel-1.1.0/src/nickel.c.o: In function `Ni_GetRoot':
/home/pnirschl/Projekte/libelektra/src/plugins/ni/nickel-1.1.0/src/nickel.c:170: multiple definition of `Ni_GetRoot'
CMakeFiles/testmod_ni.dir/ni/nickel-1.1.0/src/nickel.c.o:/home/pnirschl/Projekte/libelektra/src/plugins/ni/nickel-1.1.0/src/nickel.c:170: first defined here
../plugins/ni/CMakeFiles/elektra-ni-objects.dir/nickel-1.1.0/src/nickel.c.o: In function `Ni_GetParent':
/home/pnirschl/Projekte/libelektra/src/plugins/ni/nickel-1.1.0/src/nickel.c:178: multiple definition of `Ni_GetParent'
CMakeFiles/testmod_ni.dir/ni/nickel-1.1.0/src/nickel.c.o:/home/pnirschl/Projekte/libelektra/src/plugins/ni/nickel-1.1.0/src/nickel.c:178: first defined here
../plugins/ni/CMakeFiles/elektra-ni-objects.dir/nickel-1.1.0/src/nickel.c.o: In function `Ni_GetNumChildren':
/home/pnirschl/Projekte/libelektra/src/plugins/ni/nickel-1.1.0/src/nickel.c:185: multiple definition of `Ni_GetNumChildren'
CMakeFiles/testmod_ni.dir/ni/nickel-1.1.0/src/nickel.c.o:/home/pnirschl/Projekte/libelektra/src/plugins/ni/nickel-1.1.0/src/nickel.c:185: first defined here
../plugins/ni/CMakeFiles/elektra-ni-objects.dir/nickel-1.1.0/src/nickel.c.o: In function `Ni_GetNextChild':
/home/pnirschl/Projekte/libelektra/src/plugins/ni/nickel-1.1.0/src/nickel.c:197: multiple definition of `Ni_GetNextChild'
CMakeFiles/testmod_ni.dir/ni/nickel-1.1.0/src/nickel.c.o:/home/pnirschl/Projekte/libelektra/src/plugins/ni/nickel-1.1.0/src/nickel.c:197: first defined here
../plugins/ni/CMakeFiles/elektra-ni-objects.dir/nickel-1.1.0/src/nickel.c.o: In function `Ni_GetChild':
/home/pnirschl/Projekte/libelektra/src/plugins/ni/nickel-1.1.0/src/nickel.c:215: multiple definition of `Ni_GetChild'
CMakeFiles/testmod_ni.dir/ni/nickel-1.1.0/src/nickel.c.o:/home/pnirschl/Projekte/libelektra/src/plugins/ni/nickel-1.1.0/src/nickel.c:215: first defined here
../plugins/ni/CMakeFiles/elektra-ni-objects.dir/nickel-1.1.0/src/nickel.c.o: In function `Ni_GetModified':
/home/pnirschl/Projekte/libelektra/src/plugins/ni/nickel-1.1.0/src/nickel.c:264: multiple definition of `Ni_GetModified'
CMakeFiles/testmod_ni.dir/ni/nickel-1.1.0/src/nickel.c.o:/home/pnirschl/Projekte/libelektra/src/plugins/ni/nickel-1.1.0/src/nickel.c:264: first defined here
../plugins/ni/CMakeFiles/elektra-ni-objects.dir/nickel-1.1.0/src/nickel.c.o: In function `Ni_SetModified':
/home/pnirschl/Projekte/libelektra/src/plugins/ni/nickel-1.1.0/src/nickel.c:273: multiple definition of `Ni_SetModified'
CMakeFiles/testmod_ni.dir/ni/nickel-1.1.0/src/nickel.c.o:/home/pnirschl/Projekte/libelektra/src/plugins/ni/nickel-1.1.0/src/nickel.c:273: first defined here
../plugins/ni/CMakeFiles/elektra-ni-objects.dir/nickel-1.1.0/src/nickel.c.o: In function `Ni_GetValue':
/home/pnirschl/Projekte/libelektra/src/plugins/ni/nickel-1.1.0/src/nickel.c:298: multiple definition of `Ni_GetValue'
CMakeFiles/testmod_ni.dir/ni/nickel-1.1.0/src/nickel.c.o:/home/pnirschl/Projekte/libelektra/src/plugins/ni/nickel-1.1.0/src/nickel.c:298: first defined here
../plugins/ni/CMakeFiles/elektra-ni-objects.dir/nickel-1.1.0/src/nickel.c.o: In function `Ni_GetValueInt':
/home/pnirschl/Projekte/libelektra/src/plugins/ni/nickel-1.1.0/src/nickel.c:316: multiple definition of `Ni_GetValueInt'
CMakeFiles/testmod_ni.dir/ni/nickel-1.1.0/src/nickel.c.o:/home/pnirschl/Projekte/libelektra/src/plugins/ni/nickel-1.1.0/src/nickel.c:298: first defined here
../plugins/ni/CMakeFiles/elektra-ni-objects.dir/nickel-1.1.0/src/nickel.c.o: In function `Ni_GetValueFloat':
/home/pnirschl/Projekte/libelektra/src/plugins/ni/nickel-1.1.0/src/nickel.c:332: multiple definition of `Ni_GetValueFloat'
CMakeFiles/testmod_ni.dir/ni/nickel-1.1.0/src/nickel.c.o:/home/pnirschl/Projekte/libelektra/src/plugins/ni/nickel-1.1.0/src/nickel.c:298: first defined here
../plugins/ni/CMakeFiles/elektra-ni-objects.dir/nickel-1.1.0/src/nickel.c.o: In function `Ni_GetValueBool':
/home/pnirschl/Projekte/libelektra/src/plugins/ni/nickel-1.1.0/src/nickel.c:352: multiple definition of `Ni_GetValueBool'
CMakeFiles/testmod_ni.dir/ni/nickel-1.1.0/src/nickel.c.o:/home/pnirschl/Projekte/libelektra/src/plugins/ni/nickel-1.1.0/src/nickel.c:298: first defined here
../plugins/ni/CMakeFiles/elektra-ni-objects.dir/nickel-1.1.0/src/nickel.c.o: In function `Ni_ValueVScan':
/home/pnirschl/Projekte/libelektra/src/plugins/ni/nickel-1.1.0/src/nickel.c:388: multiple definition of `Ni_ValueVScan'
CMakeFiles/testmod_ni.dir/ni/nickel-1.1.0/src/nickel.c.o:/home/pnirschl/Projekte/libelektra/src/plugins/ni/nickel-1.1.0/src/nickel.c:298: first defined here
../plugins/ni/CMakeFiles/elektra-ni-objects.dir/nickel-1.1.0/src/nickel.c.o: In function `Ni_ValueScan':
/home/pnirschl/Projekte/libelektra/src/plugins/ni/nickel-1.1.0/src/nickel.c:374: multiple definition of `Ni_ValueScan'
CMakeFiles/testmod_ni.dir/ni/nickel-1.1.0/src/nickel.c.o:/home/pnirschl/Projekte/libelektra/src/plugins/ni/nickel-1.1.0/src/nickel.c:374: first defined here
../plugins/ni/CMakeFiles/elektra-ni-objects.dir/nickel-1.1.0/src/nickel.c.o: In function `Ni_SetValue':
/home/pnirschl/Projekte/libelektra/src/plugins/ni/nickel-1.1.0/src/nickel.c:420: multiple definition of `Ni_SetValue'
CMakeFiles/testmod_ni.dir/ni/nickel-1.1.0/src/nickel.c.o:/home/pnirschl/Projekte/libelektra/src/plugins/ni/nickel-1.1.0/src/nickel.c:420: first defined here
../plugins/ni/CMakeFiles/elektra-ni-objects.dir/nickel-1.1.0/src/nickel.c.o: In function `Ni_SetValueBool':
/home/pnirschl/Projekte/libelektra/src/plugins/ni/nickel-1.1.0/src/nickel.c:480: multiple definition of `Ni_SetValueBool'
CMakeFiles/testmod_ni.dir/ni/nickel-1.1.0/src/nickel.c.o:/home/pnirschl/Projekte/libelektra/src/plugins/ni/nickel-1.1.0/src/nickel.c:480: first defined here
../plugins/ni/CMakeFiles/elektra-ni-objects.dir/nickel-1.1.0/src/nickel.c.o: In function `Ni_ValueVPrint':
/home/pnirschl/Projekte/libelektra/src/plugins/ni/nickel-1.1.0/src/nickel.c:514: multiple definition of `Ni_ValueVPrint'
CMakeFiles/testmod_ni.dir/ni/nickel-1.1.0/src/nickel.c.o:/home/pnirschl/Projekte/libelektra/src/plugins/ni/nickel-1.1.0/src/nickel.c:514: first defined here
../plugins/ni/CMakeFiles/elektra-ni-objects.dir/nickel-1.1.0/src/nickel.c.o: In function `Ni_ValuePrint':
/home/pnirschl/Projekte/libelektra/src/plugins/ni/nickel-1.1.0/src/nickel.c:494: multiple definition of `Ni_ValuePrint'
CMakeFiles/testmod_ni.dir/ni/nickel-1.1.0/src/nickel.c.o:/home/pnirschl/Projekte/libelektra/src/plugins/ni/nickel-1.1.0/src/nickel.c:494: first defined here
../plugins/ni/CMakeFiles/elektra-ni-objects.dir/nickel-1.1.0/src/nickel.c.o: In function `Ni_SetValueInt':
/home/pnirschl/Projekte/libelektra/src/plugins/ni/nickel-1.1.0/src/nickel.c:461: multiple definition of `Ni_SetValueInt'
CMakeFiles/testmod_ni.dir/ni/nickel-1.1.0/src/nickel.c.o:/home/pnirschl/Projekte/libelektra/src/plugins/ni/nickel-1.1.0/src/nickel.c:461: first defined here
../plugins/ni/CMakeFiles/elektra-ni-objects.dir/nickel-1.1.0/src/nickel.c.o: In function `Ni_SetValueFloat':
/home/pnirschl/Projekte/libelektra/src/plugins/ni/nickel-1.1.0/src/nickel.c:471: multiple definition of `Ni_SetValueFloat'
CMakeFiles/testmod_ni.dir/ni/nickel-1.1.0/src/nickel.c.o:/home/pnirschl/Projekte/libelektra/src/plugins/ni/nickel-1.1.0/src/nickel.c:471: first defined here
../plugins/ni/CMakeFiles/elektra-ni-objects.dir/nickel-1.1.0/src/nickel.c.o: In function `Ni_WriteStream':
/home/pnirschl/Projekte/libelektra/src/plugins/ni/nickel-1.1.0/src/nickel.c:572: multiple definition of `Ni_WriteStream'
CMakeFiles/testmod_ni.dir/ni/nickel-1.1.0/src/nickel.c.o:/home/pnirschl/Projekte/libelektra/src/plugins/ni/nickel-1.1.0/src/nickel.c:572: first defined here
../plugins/ni/CMakeFiles/elektra-ni-objects.dir/nickel-1.1.0/src/nickel.c.o: In function `Ni_WriteFile':
/home/pnirschl/Projekte/libelektra/src/plugins/ni/nickel-1.1.0/src/nickel.c:551: multiple definition of `Ni_WriteFile'
CMakeFiles/testmod_ni.dir/ni/nickel-1.1.0/src/nickel.c.o:/home/pnirschl/Projekte/libelektra/src/plugins/ni/nickel-1.1.0/src/nickel.c:551: first defined here
../plugins/ni/CMakeFiles/elektra-ni-objects.dir/nickel-1.1.0/src/nickel.c.o: In function `Ni_ReadStream':
/home/pnirschl/Projekte/libelektra/src/plugins/ni/nickel-1.1.0/src/nickel.c:621: multiple definition of `Ni_ReadStream'
CMakeFiles/testmod_ni.dir/ni/nickel-1.1.0/src/nickel.c.o:/home/pnirschl/Projekte/libelektra/src/plugins/ni/nickel-1.1.0/src/nickel.c:621: first defined here
../plugins/ni/CMakeFiles/elektra-ni-objects.dir/nickel-1.1.0/src/nickel.c.o: In function `Ni_ReadFile':
/home/pnirschl/Projekte/libelektra/src/plugins/ni/nickel-1.1.0/src/nickel.c:604: multiple definition of `Ni_ReadFile'
CMakeFiles/testmod_ni.dir/ni/nickel-1.1.0/src/nickel.c.o:/home/pnirschl/Projekte/libelektra/src/plugins/ni/nickel-1.1.0/src/nickel.c:604: first defined here
../plugins/ni/CMakeFiles/elektra-ni-objects.dir/nickel-1.1.0/src/buf.c.o: In function `InitFileBuf':
/home/pnirschl/Projekte/libelektra/src/plugins/ni/nickel-1.1.0/src/buf.c:26: multiple definition of `InitFileBuf'
CMakeFiles/testmod_ni.dir/ni/nickel-1.1.0/src/buf.c.o:/home/pnirschl/Projekte/libelektra/src/plugins/ni/nickel-1.1.0/src/buf.c:26: first defined here
../plugins/ni/CMakeFiles/elektra-ni-objects.dir/nickel-1.1.0/src/buf.c.o: In function `FreeFileBuf':
/home/pnirschl/Projekte/libelektra/src/plugins/ni/nickel-1.1.0/src/buf.c:35: multiple definition of `FreeFileBuf'
CMakeFiles/testmod_ni.dir/ni/nickel-1.1.0/src/buf.c.o:/home/pnirschl/Projekte/libelektra/src/plugins/ni/nickel-1.1.0/src/buf.c:35: first defined here
../plugins/ni/CMakeFiles/elektra-ni-objects.dir/nickel-1.1.0/src/buf.c.o: In function `BufGetC':
/home/pnirschl/Projekte/libelektra/src/plugins/ni/nickel-1.1.0/src/buf.c:44: multiple definition of `BufGetC'
CMakeFiles/testmod_ni.dir/ni/nickel-1.1.0/src/buf.c.o:/home/pnirschl/Projekte/libelektra/src/plugins/ni/nickel-1.1.0/src/buf.c:44: first defined here
../plugins/ni/CMakeFiles/elektra-ni-objects.dir/nickel-1.1.0/src/buf.c.o: In function `BufSeekBack':
/home/pnirschl/Projekte/libelektra/src/plugins/ni/nickel-1.1.0/src/buf.c:84: multiple definition of `BufSeekBack'
CMakeFiles/testmod_ni.dir/ni/nickel-1.1.0/src/buf.c.o:/home/pnirschl/Projekte/libelektra/src/plugins/ni/nickel-1.1.0/src/buf.c:84: first defined here
../plugins/ni/CMakeFiles/elektra-ni-objects.dir/nickel-1.1.0/src/buf.c.o: In function `BufFlush':
/home/pnirschl/Projekte/libelektra/src/plugins/ni/nickel-1.1.0/src/buf.c:92: multiple definition of `BufFlush'
CMakeFiles/testmod_ni.dir/ni/nickel-1.1.0/src/buf.c.o:/home/pnirschl/Projekte/libelektra/src/plugins/ni/nickel-1.1.0/src/buf.c:92: first defined here
../plugins/ni/CMakeFiles/elektra-ni-objects.dir/nickel-1.1.0/src/hash.c.o: In function `hashlittle':
/home/pnirschl/Projekte/libelektra/src/plugins/ni/nickel-1.1.0/src/hash.c:332: multiple definition of `Hash'
CMakeFiles/testmod_ni.dir/ni/nickel-1.1.0/src/hash.c.o:/home/pnirschl/Projekte/libelektra/src/plugins/ni/nickel-1.1.0/src/hash.c:332: first defined here
collect2: Fehler: ld gab 1 als Ende-Status zurück
src/plugins_tests/CMakeFiles/testmod_ni.dir/build.make:218: recipe for target 'bin/testmod_ni' failed
make[2]: *** [bin/testmod_ni] Error 1
CMakeFiles/Makefile2:11177: recipe for target 'src/plugins_tests/CMakeFiles/testmod_ni.dir/all' failed
make[1]: *** [src/plugins_tests/CMakeFiles/testmod_ni.dir/all] Error 2
make[1]: *** Warte auf noch nicht beendete Prozesse...

@markus2330
Copy link
Contributor

Ohh, sorry, I see. I fixed full and broke shared.

(Above is not the build error I referred to when I said rebase might be wrong. It was about the xmltool symbol duplication.)

@markus2330
Copy link
Contributor

I think it is fixed now.

@petermax2
Copy link
Member Author

Yeah Fedora looks good too (compiling and unit tests passing).

@petermax2
Copy link
Member Author

SUCCESS 🎉

@markus2330
Copy link
Contributor

Great! We will tomorrow have a look at it together!

@markus2330
Copy link
Contributor

@Namoshek review please

catch (...)
{
throw;
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it really necessary to catch and re-throw the same error? If you are not going to clean up something else in the catch-clause, it seems not necessary.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@markus2330 I just copied from ModulesPluginDatabase::lookupInfo. Should I change it there too?

Copy link
Contributor

@Namoshek Namoshek May 19, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you copied it from somewhere, there might be an use case I didn't think of. I mean, it is quite obvious that you see this way a lot easier that there is an exception thrown by the invoked method and that it is escalated, but I guess the compiler should warn you about the exception anyway when using the getSymbol function without a try-catch clause.

Btw. it is quite hard to find anything useful regarding this construct, so I can't really tell if it is useful/good practice.

Copy link
Member Author

@petermax2 petermax2 May 19, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Namoshek I agree with you - it looks odd. The code was introduced in 10e15c4 by @markus2330 .

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I tried to fix #479 which is a real strange error: some exceptions thrown from libtool to kdb are not catched in kdb even though kdb contains a catch-all block. As this try/catch did not help to fix the problem you can safely remove it.

@petermax2
Copy link
Member Author

Thank you for the feedback, @Namoshek !


- 0: config was not changed (was ok)
- 1: config is changed (now ok)
- -1: config not ok, could not fix it
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The text was not supposed to be used 1:1, it is not even always a sentence ;)

It also does not establish that iff the function returns -1 an error has to be set.

Also please give an example.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also please give an example.

By "example" do you mean like a reference implementation of the function?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only something simple that would be useful in context of this tutorial. E.g. validating if the comment-character is only one character long or something like this..

@iandonnelly What do you think fits best?

- 1: The configuration has been changed and now it is OK
- -1: The configuration was not OK and could not be fixed. An error has to be set to errorKey.

The following example demonstrates how to limit the length of the values within the plugin configuration to 3 charaters.
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@markus2330 @Namoshek @iandonnelly is this a viable example?

the test case at testtool_backendbuilder.cpp:571 checkconfOkChanged is not OK.
I suspect something is wrong in BackendBuilder::addPlugin
checkConfPtr checkConfFunction = nullptr;
try
{
checkConfFunction = reinterpret_cast<checkConfPtr> (pluginDatabase->getSymbol (newPlugin, "checkconf"));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe we can return 0 here instead of exception?

static int checkconfLookup_a_abc (ckdb::Key * errorKey, ckdb::KeySet * config)
{
ckdb::Key * k = ckdb::ksLookupByName (config, "/a", 0);
if (k && strcmp (ckdb::keyString (k), "abc") == 0)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why having such comparision? The testcase could be even easier.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could use std::string for the comparison instead of strcmp().

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I mean: the mocks could simply append something and return 1, or return 0/-1; without any if.

@petermax2
Copy link
Member Author

petermax2 commented May 21, 2016

My clang-format behaviour differs from the build server. I think you are using clang-format 3.8 (which is not available in the default Fedora repos)

@markus2330
Copy link
Contributor

Yes, clang-format 3.8 is needed. You can download packages for many distributions at http://llvm.org/releases/download.html

ckdb::Key * k = ckdb::ksLookupByName (config, "user/b", 0);
if (!k)
{
ckdb::ksAppendKey (config, ckdb::keyNew ("user/b", KEY_VALUE, "test", KEY_END));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AppendKey will overwrite the key if it exists. The name of the function suggests that it will always append.

@petermax2
Copy link
Member Author

MountBackendBuilder has two configurations:

  1. backendConf
  2. mountConf

Are both configurations supposed to be checked by checkconf?

Do we pass these additional configurations as new paramter to checkconf?

@markus2330
Copy link
Contributor

No, mountConf is irrelevant in this context, it contains the keys of system/elektra/mountpoints. (Needed to detect if a mountpoint already exists).

The backendConf should be in system-namespace, the pluginConf in user-namespace (in one KeySet). The idea is: When you use cascading lookups within checkconf, you will automatically get the correct (preferred) configuration.

After calling checkconf you need again to separate the backend- and pluginconfig.

@markus2330
Copy link
Contributor

(Could you please update this information as comment to mountConf, if I change it, we will have a merge conflict)

@markus2330
Copy link
Contributor

Btw. I updated the docu how to pop keys from a keyset, see f41e01b

Its sometimes quite confusing how to pop all or specific keys from a keyset.

@petermax2
Copy link
Member Author

(Could you please update this information as comment to mountConf, if I change it, we will have a merge conflict)

Done!

The backendConf should be in system-namespace, the pluginConf in user-namespace (in one KeySet)

Like this?

ckdb::KeySet * pluginConfig = newPlugin.getConfig ().dup ();
ckdb::ksAppend(pluginConfig, backendConfig);

After calling checkconf you need again to separate the backend- and pluginconfig.

Like iterating over the KeySet and checking with keyIsSystem (const Key *key)?

@petermax2
Copy link
Member Author

@markus2330 Did you forget to reformat examples/kdbget.c?

@markus2330
Copy link
Contributor

Ohh, sorry. Is fixed in a614938

Please add test cases for changes to plugin+backend config. Separation works with ksCut("system"/"user").

@petermax2
Copy link
Member Author

Last question: does it make sense that BackendBuilder::addPlugin provides its own checkconf (without the backend config) or should checkconf be solely provided by MountBackendBuilder? And what about GlobalPluginsBuilder?

@markus2330
Copy link
Contributor

markus2330 commented May 22, 2016

Yes, it makes sense to have checkconf calls in BackendBuilder::addPlugin to support checkconf for the global plugins and export/import backendBuilder (yet to come), e.g. because crypto might be used in both of these scenarios.

So maybe the backendConf should be moved up to BackendBuilder, a -c option for kdb global-mount and kdb export/import is useful anyway.

Btw. there is also SpecReader (kdb mount-spec), but it sits on top of MountBackendBuilder, so its irrelevant for this discussion.

@petermax2
Copy link
Member Author

@Namoshek @markus2330 final review please!

@petermax2 petermax2 mentioned this pull request May 27, 2016
7 tasks
@markus2330 markus2330 merged commit bc7176f into ElektraInitiative:master Jun 15, 2016
@markus2330
Copy link
Contributor

Finally its merged, great job!

@petermax2 petermax2 deleted the checkconf2 branch June 15, 2016 13:33
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants