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

type plugin fails to validate chars #1489

Closed
tom-wa opened this issue May 8, 2017 · 3 comments
Closed

type plugin fails to validate chars #1489

tom-wa opened this issue May 8, 2017 · 3 comments

Comments

@tom-wa
Copy link
Contributor

tom-wa commented May 8, 2017

steps to reproduce:

kdb mount typetest.dump user/typetest dump type
kdb set user/typetest/key a
kdb setmeta user/typetest/key check/type char
# RET:0

kdb get user/typetest/key
#> a

kdb rm user/typetest/key
kdb umount user/typetest

results in:

CMD: kdb setmeta user/typetest/key check/type char
RET: 5
=== FAILED return value doesn't match expected pattern 0
STDERR: The command kdb setmeta failed while accessing the key database with the info:
Sorry, the error (#52) occurred ;(
Description: could not type check value of key
Ingroup: plugin
Module: type
At: /home/thomas/Dev/Elektra/libelektra/src/plugins/type/type.cpp:31
Reason: The type char failed to match for user/typetest/key with string: a
Mountpoint: user/typetest
Configfile: /home/thomas/.config/typetest.dump.31273:1494217372.63589.tmp

adding

TEST (type, char)
{
	KeySet config;
	TypeChecker tc (config);

	Key k ("user/anything", KEY_VALUE, "a", KEY_META, "check/type", "char", KEY_END);
	succeed_if (tc.check (k), "should check successfully");
	k.setString ("b");
	succeed_if (tc.check (k), "should check successfully");
}

to testmod_type also results in

[  FAILED  ] 1 test, listed below:
[  FAILED  ] type.char
@markus2330
Copy link
Contributor

Thanks for the bug report, what an oversight! Great to see activity from you again!

Is it enough to check for char+octet if the length of the string is 1? Or are there other CORBA rules applying in these situations? Please reopen if it was not fixed.

Thanks for the testcase+shellrecorder snippet! I added them

@tom-wa
Copy link
Contributor Author

tom-wa commented May 8, 2017

i think we should use unsigned char explicitly ( #1388)

@markus2330
Copy link
Contributor

Where are we not using unsiged char? In src/include/kdbtypes.h it is always unsigned char. Please open a new issue if you mean somewhere else.

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

No branches or pull requests

2 participants