libelektra icon indicating copy to clipboard operation
libelektra copied to clipboard

Feature proposal: Output error/warning if a key that isn't in spec-file is set

Open qwepoizt opened this issue 4 years ago • 4 comments
trafficstars

Notes

  • I'd like to fix this as part of my thesis.
  • Is this a sensible improvement or is there a reason for the current behavior?
  • I've searched through the existing issues but found no mention of this.
  • This could be implemented as an optional feature that is disabled by default.

Current behavior

  1. Create file test.ini with content:
[]
mountpoint = test.ecf

[mykeyfromspec]
type = boolean
check/type = boolean
  1. sudo kdb mount -v `pwd`/test.ini spec:/tests/test ni
  2. sudo kdb spec-mount /tests/
  3. kdb set /tests/test/mykeyfromspec true
  4. kdb set /tests/test/somekeynotinspec somevalue
  5. kdb set /tests/test/subtree/somekeynotinspec somevalue

Proposed behavior

  • Steps 1 to 4. as above
  • Step 5 and 6 output an error/warning, that a key was set, that is not part of the specification file (or that has no spec-related metadata).

Motivation

  • If one purpose of spec files is describing what configuration options a software does (not) support, this would make sense.
  • During my work on Elektrifying redshift I often used kdb set on some keys that weren't part of the spec and wondered why I didn't receive a warning that they validate a check/ rule (e.g. when I accidentally spelt the keyname wrong in my kdb set call).

qwepoizt avatar Aug 06 '21 17:08 qwepoizt

@markus2330 What do you think about this?

qwepoizt avatar Aug 24 '21 13:08 qwepoizt

Do structs solve the issue you describe here?

markus2330 avatar Aug 27 '21 16:08 markus2330

Thanks @markus2330 for your input. I will get back to you after my work on other issues.

qwepoizt avatar Aug 31 '21 08:08 qwepoizt

I mark this issue stale as it did not have any activity for one year. I'll close it in two weeks if no further activity occurs. If you want it to be alive again, ping the issue by writing a message here or create a new issue with the remainder of this issue. Thank you for your contributions :sparkling_heart:

stale[bot] avatar Sep 09 '22 01:09 stale[bot]

I closed this issue now because it has been inactive for more than one year. If I closed it by mistake, please do not hesitate to reopen it or create a new issue with the remainder of this issue. Thank you for your contributions :sparkling_heart:

stale[bot] avatar Sep 28 '22 03:09 stale[bot]

This conflicts with #3938

kodebach avatar Sep 28 '22 09:09 kodebach