Tom G. Christensen
2017-Mar-31 19:30 UTC
testsuite error on Solaris 2.6 [Re: Announce: OpenSSH 7.5 released]
On 27/03/17 17:06, Tom G. Christensen wrote:> On 20/03/17 14:31, Damien Miller wrote: >> OpenSSH 7.5 has just been released. It will be available from the >> mirrors listed at http://www.openssh.com/ shortly. >> > > I'm seeing an error in the testsuite on Solaris 2.6: > test_utf8: ........................ > regress/unittests/utf8/tests.c:48 test #25 "c_esc" > ASSERT_INT_EQ(len, wantlen) failed: > len = -1 > wantlen = 5 > > > It seems this might be related to the fact that on Solaris < 7 > nl_langinfo(CODESET) returns an empty string when the codeset is ASCII. > > To verify I put together a small testprogram that does a setlocale > followed by nl_langinfo(CODESET) and for the 'C' locale it returns an > empty string while 'da' returns ISO8859-1 as expected. >I worked some more on this and comparing locales and their codesets between Solaris 2.6 and 7 I'm reasonably sure that an empty codeset value means ascii on Solaris 2.6. So to ensure proper operation and get rid of the error in the testsuite I've added "" as a valid alias for ascii in dangerous_locales(). With this change in place the testsuite runs with no errors. -tgc
Hi, Tom G. Christensen wrote on Fri, Mar 31, 2017 at 09:30:10PM +0200:> On 27/03/17 17:06, Tom G. Christensen wrote:>> I'm seeing an error in the testsuite on Solaris 2.6: >> test_utf8: ........................ >> regress/unittests/utf8/tests.c:48 test #25 "c_esc" >> ASSERT_INT_EQ(len, wantlen) failed: >> len = -1 >> wantlen = 5 >> >> >> It seems this might be related to the fact that on Solaris < 7 >> nl_langinfo(CODESET) returns an empty string when the codeset is ASCII. >> >> To verify I put together a small testprogram that does a setlocale >> followed by nl_langinfo(CODESET) and for the 'C' locale it returns an >> empty string while 'da' returns ISO8859-1 as expected.> I worked some more on this and comparing locales and their codesets > between Solaris 2.6 and 7 I'm reasonably sure that an empty codeset > value means ascii on Solaris 2.6.I'm not quite sure how relevant Solaris 2.6 still is, but i dimly remeber having seen systems where nl_langinfo(3) returns "" for ASCII before, though i have forgotten which ones.> So to ensure proper operation and get rid of the error in the testsuite > I've added "" as a valid alias for ascii in dangerous_locales(). > With this change in place the testsuite runs with no errors.That would be the following patch. I don't see any downside. A system where nl_codeset(3) would return "" for some non-ASCII and non-UTF-8 locale would probably cause you worse grief than sftp(1) or scp(1) potentially screwing up your terminal settings. OK? Ingo Index: utf8.c ==================================================================RCS file: /cvs/src/usr.bin/ssh/utf8.c,v retrieving revision 1.5 diff -u -p -r1.5 utf8.c --- utf8.c 19 Feb 2017 00:10:57 -0000 1.5 +++ utf8.c 2 Apr 2017 13:35:38 -0000 @@ -51,8 +51,8 @@ dangerous_locale(void) { char *loc; loc = nl_langinfo(CODESET); - return strcmp(loc, "US-ASCII") != 0 && strcmp(loc, "UTF-8") != 0 && - strcmp(loc, "ANSI_X3.4-1968") != 0; + return *loc != '\0' && strcmp(loc, "US-ASCII") != 0 && + strcmp(loc, "UTF-8") != 0 && strcmp(loc, "ANSI_X3.4-1968") != 0; } static int
On 02/04/17 15:43, Ingo Schwarze wrote:> Tom G. Christensen wrote on Fri, Mar 31, 2017 at 09:30:10PM +0200: >> I worked some more on this and comparing locales and their codesets >> between Solaris 2.6 and 7 I'm reasonably sure that an empty codeset >> value means ascii on Solaris 2.6. > > I'm not quite sure how relevant Solaris 2.6 still is, but i dimly > remeber having seen systems where nl_langinfo(3) returns "" for > ASCII before, though i have forgotten which ones. >I doubt Solaris 2.6 or 7 for that matter has any commercial relevance I just work on these old releases for hobbyist purposes. I uploaded my OpenSSH 7.5p1 packages here: https://jupiterrise.com/>> So to ensure proper operation and get rid of the error in the testsuite >> I've added "" as a valid alias for ascii in dangerous_locales(). >> With this change in place the testsuite runs with no errors. > > That would be the following patch. I don't see any downside. > A system where nl_codeset(3) would return "" for some non-ASCII > and non-UTF-8 locale would probably cause you worse grief than > sftp(1) or scp(1) potentially screwing up your terminal settings. >For reference this is the patch I made and included in my Solaris 2.6 openssh packages: https://github.com/tgc/tgcware-for-solaris/blob/master/openssh/src/0001-Treat-empty-codeset-value-as-ascii.patch> OK? > Ingo > > > Index: utf8.c > ==================================================================> RCS file: /cvs/src/usr.bin/ssh/utf8.c,v > retrieving revision 1.5 > diff -u -p -r1.5 utf8.c > --- utf8.c 19 Feb 2017 00:10:57 -0000 1.5 > +++ utf8.c 2 Apr 2017 13:35:38 -0000 > @@ -51,8 +51,8 @@ dangerous_locale(void) { > char *loc; > > loc = nl_langinfo(CODESET); > - return strcmp(loc, "US-ASCII") != 0 && strcmp(loc, "UTF-8") != 0 && > - strcmp(loc, "ANSI_X3.4-1968") != 0; > + return *loc != '\0' && strcmp(loc, "US-ASCII") != 0 && > + strcmp(loc, "UTF-8") != 0 && strcmp(loc, "ANSI_X3.4-1968") != 0; > } > > static int >Note that in 7.5p1, '646' was added as an additional alias (which happened to cover not only NetBSD but also Solaris 7 and later.) -tgc