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

Crash when reading numbers and/or boolean values from ini files #64

Open
deining opened this issue Jun 27, 2020 · 1 comment
Open

Crash when reading numbers and/or boolean values from ini files #64

deining opened this issue Jun 27, 2020 · 1 comment

Comments

@deining
Copy link
Contributor

deining commented Jun 27, 2020

Even with #63 applied, reading from .ini files can fail:

Minimum working example:

test.ini

[database]
verbose=true
port=5432

test.lua

1 cli = require 'cliargs';
2 tbl = cli:read_defaults('test.ini', 'ini', 'database', false);

Running test.lua result in this error:

attempt to index a boolean value (local 'str')
stack traceback:
	./cliargs/utils/trim.lua:3: in function 'cliargs.utils.trim'
	./cliargs/config_loader.lua:99: in function 'cliargs.config_loader.from_ini'
	(...tail calls...)
	./test.lua:2: in main chunk
	[C]: in ?

Notes:

  • the error does not occur once I read only string values from the ini file
  • the error disappear once I set the fourth parameter of function read_defaults to true (line 2)
@deining
Copy link
Contributor Author

deining commented Jul 4, 2020

PR #63 now contains a failing test case #read_defaults_from_ini_file_group_with_cast related this issue. It is currently disabled as there is no fix available yet.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant