libelektra: spec: does not remove copied metadata before writing config

I think this is a show-stopper for using in LCDproc or machinekit (who want INI as first step for smooth migration)

Steps to Reproduce the Problem

  • mount a specification
  • mount an INI file
  • do a kdb set
kdb mount wrong-copy.ini /tests ini
kdb setmeta /tests/some-key some-meta some-value
kdb set /tests/some-key x

Expected Result

To have a file

some-key = x

Actual Result

#@META some-meta = some-value
some-key = x

System Information

  • Elektra Version: master

Implementation Hints

The spec plugin does not have the positioning to remove its meta-data before writing to the storage. See discussion below: the KeySet passed back from kdbSet must not be altered. Only the meta-data within split is allowed to be removed.

So the easiest way is to call the spec plugin for every part in the split plugin separately. (As foreach plugin.)

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Comments: 18 (15 by maintainers)

Most upvoted comments

@kodebach thanks for the info. The design doc afair states that the position should be given to the global plugin via parentKey, so the position should be easy to determine. I’ll ping you if I get stuck with spec as I don’t know anything about it.

spec also needs to be updated so that it actually removes the metadata on the second elektraSpecSet run (which must be immediately before the setstorage plugin runs). Also, I’ll point out again that we should introduce some standard way for plugins to find out in which position they are begin called (without the need for each plugin to internally count positions).


Sidenote: I think certain metakeys (like type or description) should never be removed (even if they are unchanged to the spec), since they may be used by the storage plugin.

@mpranj can you keep this in mind when you look at the positioning? afaik @tom-wa said it is “only” about executing spec one more time.