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

make test fails when checking at-charset #303

Closed
ScrumpyJack opened this Issue Apr 6, 2017 · 6 comments

Comments

Projects
None yet
4 participants
@ScrumpyJack

ScrumpyJack commented Apr 6, 2017

i get the following error during make test

gammu/src/gammu-1.38.2/tests$ ctest -V -R at-charset 
UpdateCTestConfiguration  from :/home/scrumpyjack/aports/community/gammu/src/gammu-1.38.2/tests/DartConfiguration.tcl
UpdateCTestConfiguration  from :/home/scrumpyjack/aports/community/gammu/src/gammu-1.38.2/tests/DartConfiguration.tcl
Test project /home/scrumpyjack/aports/community/gammu/src/gammu-1.38.2/tests
Constructing a list of tests
Done constructing a list of tests
Updating test list for fixtures
Added 0 tests to meet fixture requirements
Checking test dependency graph...
Checking test dependency graph end
test 400
    Start 400: at-charset

400: Test command: /home/scrumpyjack/aports/community/gammu/src/gammu-1.38.2/tests/at-charset
400: Test timeout computed to be: 9.99988e+06
400: Test "latin1cp437" failed ('', '********')!
1/1 Test #400: at-charset .......................***Failed    0.01 sec

0% tests passed, 1 tests failed out of 1

Total Test time (real) =   0.08 sec

The following tests FAILED:
        400 - at-charset (Failed)
Errors while running CTest
make: *** [Makefile:106: test] Error 8

any pointers?


Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

@nijel

This comment has been minimized.

Show comment
Hide comment
@nijel

nijel Apr 11, 2017

Member

Maybe iconv does not support this charset on your platform? Can you please post here output of iconv -l?

Member

nijel commented Apr 11, 2017

Maybe iconv does not support this charset on your platform? Can you please post here output of iconv -l?

@nijel nijel added the bug label Apr 11, 2017

@nijel nijel self-assigned this Apr 11, 2017

@TBK

This comment has been minimized.

Show comment
Hide comment
@TBK

TBK Oct 27, 2017

@nijel @ScrumpyJack is building gammu on Alpine Linux (musl libc).

Where are the supported charsets are (iconv -l):
UTF-8, UTF-16BE, UTF-16LE, UTF-32BE, UTF32-LE, UCS-2BE, UCS-2LE, WCHAR_T, US_ASCII, ISO8859-1, ISO8859-2, ISO8859-3, ISO8859-4, ISO8859-5, ISO8859-6, ISO8859-7, ...

This might give some insight to the right person - https://wiki.musl-libc.org/functional-differences-from-glibc.html#iconv

TBK commented Oct 27, 2017

@nijel @ScrumpyJack is building gammu on Alpine Linux (musl libc).

Where are the supported charsets are (iconv -l):
UTF-8, UTF-16BE, UTF-16LE, UTF-32BE, UTF32-LE, UCS-2BE, UCS-2LE, WCHAR_T, US_ASCII, ISO8859-1, ISO8859-2, ISO8859-3, ISO8859-4, ISO8859-5, ISO8859-6, ISO8859-7, ...

This might give some insight to the right person - https://wiki.musl-libc.org/functional-differences-from-glibc.html#iconv

@nijel

This comment has been minimized.

Show comment
Hide comment
@nijel

nijel Nov 17, 2017

Member

The problem is that musl apparently has bad definition of cp437 encoding - it does have wrong mapping for í - it converts it to ¡.

Round trip fails:

$ echo í | musl-iconv -f utf-8 -t cp437 | musl-iconv -f cp437 -t utf-8
*
$ echo í | glibc-iconv -f utf-8 -t cp437 | glibc-iconv -f cp437 -t utf-8
í

Converting from cp437 leads to different character:

$ hd /tmp/f
00000000  a1 0a                                             |..|
00000002
$ glibc-iconv -f cp437 -t utf-8 < /tmp/f 
í
$ musl-iconv -f cp437 -t utf-8 < /tmp/f 
¡

So this is clearly musl bug.

If you want workaround, you can remove this test:

diff --git a/tests/at-charset.c b/tests/at-charset.c
index 36d61c612..cb36551c4 100644
--- a/tests/at-charset.c
+++ b/tests/at-charset.c
@@ -93,15 +93,6 @@ int main(int argc UNUSED, char **argv UNUSED)
 	test_result(mywstrncmp(ubuffer, latin1text, sizeof(latin1text) / 2) == TRUE);
 
 #ifdef ICONV_FOUND
-	Priv->Charset = AT_CHARSET_PCCP437;
-	error = ATGEN_EncodeText(s, latin1text, sizeof(latin1text) / 2, buffer, sizeof(buffer), &result);
-	gammu_test_result(error, "Encode - 3");
-	strconv_test_result(latin1cp437, buffer, result);
-
-	error = ATGEN_DecodeText(s, buffer, result, ubuffer, sizeof(ubuffer), FALSE, FALSE);
-	gammu_test_result(error, "Decode - 3");
-	test_result(mywstrncmp(ubuffer, latin1text, sizeof(latin1text) / 2) == TRUE);
-
 	Priv->Charset = AT_CHARSET_ISO88591;
 	error = ATGEN_EncodeText(s, latin1text, sizeof(latin1text) / 2, buffer, sizeof(buffer), &result);
 	gammu_test_result(error, "Encode - 4");
Member

nijel commented Nov 17, 2017

The problem is that musl apparently has bad definition of cp437 encoding - it does have wrong mapping for í - it converts it to ¡.

Round trip fails:

$ echo í | musl-iconv -f utf-8 -t cp437 | musl-iconv -f cp437 -t utf-8
*
$ echo í | glibc-iconv -f utf-8 -t cp437 | glibc-iconv -f cp437 -t utf-8
í

Converting from cp437 leads to different character:

$ hd /tmp/f
00000000  a1 0a                                             |..|
00000002
$ glibc-iconv -f cp437 -t utf-8 < /tmp/f 
í
$ musl-iconv -f cp437 -t utf-8 < /tmp/f 
¡

So this is clearly musl bug.

If you want workaround, you can remove this test:

diff --git a/tests/at-charset.c b/tests/at-charset.c
index 36d61c612..cb36551c4 100644
--- a/tests/at-charset.c
+++ b/tests/at-charset.c
@@ -93,15 +93,6 @@ int main(int argc UNUSED, char **argv UNUSED)
 	test_result(mywstrncmp(ubuffer, latin1text, sizeof(latin1text) / 2) == TRUE);
 
 #ifdef ICONV_FOUND
-	Priv->Charset = AT_CHARSET_PCCP437;
-	error = ATGEN_EncodeText(s, latin1text, sizeof(latin1text) / 2, buffer, sizeof(buffer), &result);
-	gammu_test_result(error, "Encode - 3");
-	strconv_test_result(latin1cp437, buffer, result);
-
-	error = ATGEN_DecodeText(s, buffer, result, ubuffer, sizeof(ubuffer), FALSE, FALSE);
-	gammu_test_result(error, "Decode - 3");
-	test_result(mywstrncmp(ubuffer, latin1text, sizeof(latin1text) / 2) == TRUE);
-
 	Priv->Charset = AT_CHARSET_ISO88591;
 	error = ATGEN_EncodeText(s, latin1text, sizeof(latin1text) / 2, buffer, sizeof(buffer), &result);
 	gammu_test_result(error, "Encode - 4");

@nijel nijel closed this Nov 17, 2017

@TBK

This comment has been minimized.

Show comment
Hide comment
@TBK

TBK Nov 17, 2017

@nijel Thanks for your effort. I will report it upstream.

TBK commented Nov 17, 2017

@nijel Thanks for your effort. I will report it upstream.

@richfelker

This comment has been minimized.

Show comment
Hide comment
@richfelker

richfelker Nov 22, 2017

This is fixed upstream in musl. I believe Alpine edge will be incorporating the upstream iconv improvements soon since many of them were made at Alpine's request.

This is fixed upstream in musl. I believe Alpine edge will be incorporating the upstream iconv improvements soon since many of them were made at Alpine's request.

@nijel

This comment has been minimized.

Show comment
Hide comment
@nijel

nijel Nov 22, 2017

Member

Great, thanks for pushing this upstream!

Member

nijel commented Nov 22, 2017

Great, thanks for pushing this upstream!

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