Call for testing: OpenSSH 7.8

Ingo Schwarze
Mon, 20 Aug 2018 14:00:54 -0000

Hi,

Michael Felt wrote on Mon, Aug 20, 2018 at 11:28:26AM
+0200:
> On 20/08/2018 10:33, Michael Felt wrote:
>> On 17/08/2018 17:15, Ingo Schwarze wrote:
>>> Darren Tucker wrote on Fri, Aug 17, 2018 at 07:16:03AM -0700:
>>>> On 13 August 2018 at 15:06, Val Baranov <val.baranov at
duke.edu> wrote:

>>>>> test_utf8: ........................
>>>>> regress/unittests/utf8/tests.c:48 test #25
"c_esc"
>>>>> ASSERT_INT_EQ(len, wantlen) failed:
>>>>>          len = -1
>>>>>      wantlen = 5

>>>> This boils down to meaning OpenSSH's smnprintf call failed
for the
>>>> string "\033x" instead of returning the expected
escaped version
>>>> "\\033x".  The code is in utf8.c but I am not sure
why it failed.

>>> Actually, it is *supposed* to fail unless the locale is either
>>> UTF-8 or the POSIX (ASCII) locale, because '\033' is not a
>>> printable character and attempting to escape invalid stuff
>>> is unsafe in arbitrary locales.

Sorry, i spoke too soon, i didn't correctly remember how the tests
work.  It is completely irrelevant what the user sets their locale to,
as it should in a test suite.  The tests themselves make sure the
locale ist set correctly for the tests.  The "c_esc" in the test
output above means that it is testing the "C" locale at that point.

So the problem is somewhere else, likely in what your nl_langinfo(3)
function does in the POSIX locale.  Could you please run the following
simple test program on your system and show us the output, for further
diagnosis?

OpenBSD:
 $ make nl_langinfo
cc -O2 -pipe    -o nl_langinfo nl_langinfo.c
 $ ./nl_langinfo
setlocale -> "C"
nl_langinfo -> "US-ASCII"

Linux:
 $ make nl_langinfo
cc     nl_langinfo.c   -o nl_langinfo
 $ ./nl_langinfo
setlocale -> "C"
nl_langinfo -> "ANSI_X3.4-1968"

AIX:
 ?

Thank you,
  Ingo


 $ cat nl_langinfo.c
#include <err.h>
#include <langinfo.h>
#include <locale.h>
#include <stdio.h>

int
main(void)
{
	char *res;

	res = setlocale(LC_CTYPE, "C");
	if (res == NULL)
		err(1, "setlocale");
	printf("setlocale -> \"%s\"\n", res);

	res = nl_langinfo(CODESET);
	if (res == NULL)
		err(1, "nl_langinfo");
	printf("nl_langinfo -> \"%s\"\n", res);

	return 0;
}