Libelektra: cleanup keyNew

Created on 3 Nov 2019  路  5Comments  路  Source: ElektraInitiative/libelektra

remove deprecated meta flags from keyNew (303-334) and all tests that test them

https://github.com/ElektraInitiative/libelektra/blob/7fb0deefbf2c373533eda4c8a47f1018c17c5846/src/libs/elektra/keyhelpers.c#L308-L339

cleanup good first issue

All 5 comments

I found some statements where KEY_META is used instead of some of the deprecated flags (like instead of using KEY_MODE its possible to use KEY_META with 2 parameters "mode" and the value as a string. I am trying to rewrite the testcases which uses the deprecated flags but the the test cases with KEY_DIR fails.

How can rewrite this one?
key = keyNew ("user", KEY_DIR, KEY_END);
succeed_if (keyGetMode (key) == 0700, "new key with KEY_DIR not 0700 by default");

I tried to use KEY_META, "mode", "0775" but it doesn't work :D

.. or shall I really remove all of the tests which use one of the deprecated flags.

I found some statements where KEY_META is used instead of some of the deprecated flags (like instead of using KEY_MODE its possible to use KEY_META with 2 parameters "mode" and the value as a string.

Yes, it is possible but mode currently does not have any meaning: if you look into doc/METADATA.md you see it is declared as deprecated, so you can remove also the occurrences in doc/METADATA.md so that we can get completely rid of this.

I am trying to rewrite the testcases which uses the deprecated flags but the the test cases with KEY_DIR fails.

You do not need to rewrite all testcases but only these which add a value to the test suite.

How can rewrite this one?
key = keyNew ("user", KEY_DIR, KEY_END);
succeed_if (keyGetMode (key) == 0700, "new key with KEY_DIR not 0700 by default");

This one does not test anything of relevance: It only tested the interplay of KEY_DIR and the resulting mode. As both things will be removed, the test does not test anything anymore.

I tried to use KEY_META, "mode", "0775" but it doesn't work :D

Yes :smile:

.. or shall I really remove all of the tests which use one of the deprecated flags.

Maybe some of them test something in the core which is not tested by other tests. You can have a look at https://doc.libelektra.org/coverage/

But most likely all these tests can be remove without changing anything in the coverage of the core.

I am a little bit confused.. facepalm. I am working on 7fb0dee but where should I commit my changes....cuz I cant see the changes from 7fb... on the master branch. Do I need to commit my changes to that specific commit sha (and how xD...this is like commit-ception) ?!

Every commit gets a new SHA-1 and a pull request can have several commits. So you simply commit on top of your branch, not on top of a commit (this can happen if you make a checkout of a commit).

Simply git checkout to your branch to continue work. If everything else fails, make a new fork, make a new clone of that fork and copy all your files there.

Btw. calling git status often helps. If it does not help for you, post it here and we will translate it for you.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

markus2330 picture markus2330  路  35Comments

markus2330 picture markus2330  路  28Comments

haraldg picture haraldg  路  65Comments

raphi011 picture raphi011  路  32Comments

markus2330 picture markus2330  路  28Comments