Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ini plugin has problems with multiline metadata #2467

Open
Piankero opened this Issue Mar 8, 2019 · 7 comments

Comments

3 participants
@Piankero
Copy link
Contributor

Piankero commented Mar 8, 2019

Steps to Reproduce the Problem

The ini plugin does not save multiline data properly unfortunately.

Create a file with the following content

[]
mountpoint = LCDd-spec.conf
infos/plugins = ini validation

[server/driverpath]
type = string
check/type = string
check/validation = .*[\/]$
check/validation/match = LINE
check/validation/message = "The path has to contain a backslack (/) at the end"
default = "server/drivers/"
description = "Where can we find the driver modules ?
  IMPORTANT: Make sure to change this setting to reflect your
             specific setup! Otherwise LCDd won't be able to find
             the driver modules and will thus not be able to
             function properly.
  NOTE: Always place a slash as last character !"

Then mount it and set a valid path:

kdb mount /home/wespe/Desktop/tmp.ini spec/tmp ni                             
kdb spec-mount /tmp
kdb set /tmp/server/driverpath '/tmp/directory2/'     

#Now the error occurs because the data is saved incorrectly                                                       
kdb set /tmp/server/driverpath '/tmp/directory/' 
#> Using name user/tmp/server/driverpath
#> The command kdb set failed while accessing the key database with the info:
#>  Sorry, 1 warning was issued ;(
#>  Warning (#52):
#> 	Description: could not type check value of key
#> 	Ingroup: plugin
#> 	Module: type
#> 	At: /media/wespe/extended/repository/libelektra/src/plugins/type/type.cpp:31
#> 	Reason: The type string failed to match for user/tmp/server/IMPORTANT: Make sure to change this setting to reflect your with string: 
#> 	Mountpoint: user/tmp
#> 	Configfile: /home/wespe/.config/kdb/user/LCDd-spec.conf.3875:1552046962.490367.tmp
#> Sorry, the error (#42) occurred ;(
#> Description: key value failed to validate
#> Reason: The path has to contain a backslack (/) at the end
#> Ingroup: plugin
#> Module: validator
#> At: /media/wespe/extended/repository/libelektra/src/plugins/validation/validation.c:148
#> Mountpoint: user/tmp
#> Configfile: /home/wespe/.config/kdb/user/LCDd-spec.conf.3875:1552046962.490367.tmp

Despite a correct path, the file which contains the data has multiple lines and the ini plugins seems to also take these into account.

When I look into the file where it is saved I see the following content:

[server]
#@META check/type = string
#@META check/validation = .*[\/]$
#@META check/validation/match = LINE
#@META check/validation/message = The path has to contain a backslack (/) at the end
#@META default = server/drivers/
#@META description = Where can we find the driver modules ?
  IMPORTANT: Make sure to change this setting to reflect your
             specific setup! Otherwise LCDd won't be able to find
             the driver modules and will thus not be able to
             function properly.
  NOTE: Always place a slash as last character !
#@META type = string
driverpath = /tmp/directory2/

Expected Result

Multiline metadata are allowed

Actual Result

Multiline metadata cause problems

System Information

  • Elektra Version: 0.8.26
@markus2330

This comment has been minimized.

Copy link
Contributor

markus2330 commented Mar 9, 2019

Thank you for reporting this bug!

The bug can also be reproduced if the default plugin is not ini.

I see here two problems:

  1. the metadata from spec should not be copied into the config file (spec plugin seems to not remove the metadata, I think this is caused by wrong/missing positioning and will hopefully be fixed by @mpranj)
  2. ini plugin does not support multi-line metadata. This should be no problem once 1. is fixed
@Piankero

This comment has been minimized.

Copy link
Contributor Author

Piankero commented Mar 9, 2019

Using the dump plugin though mitigates this problem

@markus2330

This comment has been minimized.

Copy link
Contributor

markus2330 commented Mar 9, 2019

The dump plugin in infos/plugins of course does. But the dump plugin as default plugin?

Btw. 0.6.28 would be a very old Elektra version but it did not exist.

@Piankero

This comment has been minimized.

Copy link
Contributor Author

Piankero commented Mar 9, 2019

But the dump plugin as default plugin?

What exactly is the question here? If the dump plugin is a senseful default plugin?

Btw. 0.6.28 would be a very old Elektra version but it did not exist.

That was actually my mistake, it is 0.8.26 of course.

@markus2330

This comment has been minimized.

Copy link
Contributor

markus2330 commented Mar 9, 2019

What exactly is the question here? If the dump plugin is a senseful default plugin?

The question is if your statement "Default plugin is ini" in the bug report is relevant to this bug.

@Piankero

This comment has been minimized.

Copy link
Contributor Author

Piankero commented Mar 10, 2019

I thought it would because the file is saved in the ini format. But this actually comes from this line: infos/plugins = ini validation. I removed that sentence stating my default plugin

@alexsaber

This comment has been minimized.

Copy link

alexsaber commented Mar 20, 2019

Hi! Can you please assign me to this issue? I have picked 3 more ini related problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.