Skip to content
Tcl Source Code View Ticket
Login

View Ticket

2001-11-20
21:23 • Ticket [483468ffff] failure in unixInit.test status still Closed with 4 othe... artifact: 4e40da9492 user: mkuhn
16:16 • Closed ticket [483468ffff]. artifact: f2c2777c20 user: hobbs
01:58 • Ticket [483468ffff]: 4 changes artifact: a245814a00 user: hobbs
2001-11-19
23:25 • Ticket [483468ffff]: 4 changes artifact: 5520c025af user: dgp
15:49 • New ticket [483468ffff]. artifact: cf591b1748 user: msofer

failure in unixInit.test

Closed / Fixed483468ffffffffffffffffffffffffffffffffffCreated 25 years agoUpdated 25 years ago
Descriptionplain2001-11-19 15:49:29
(Assigning to Jeff as I think the error is in since his
latest commits to unix/tclUnixInit.c)

[mig@mini unix]$ uname -a
Linux mini 2.2.19-6.2.7 #3 Fri Jul 6 16:56:07 ART 2001
i686 unknown
[mig@mini unix]$ ./tcltest ../tests/unixInit.test 

==== unixInit-3.2 TclpSetInitialEncodings FAILED
==== Contents of test case:

    set env(LANG) japanese
    catch {set oldlc_all $env(LC_ALL)}
    set env(LC_ALL) japanese

    set f [open "|[list $::tcltest::tcltest]" w+]
    fconfigure $f -buffering none
    puts $f {puts [encoding system]; exit}
    set enc [gets $f]
    close $f
    unset env(LANG)
    unset env(LC_ALL)
    catch {set env(LC_ALL) $oldlc_all}

    set validEncodings [list euc-jp]
    if {[string match HP-UX $tcl_platform(os)]} {
        # Some older HP-UX systems need us to accept
this as valid
        # Bug 453883 reports that newer HP-UX systems
report euc-jp
        # like everybody else.
        lappend validEncodings shiftjis
    }
    expr {[lsearch -exact $validEncodings $enc] < 0}

---- Result was:
1
---- Result should have been (exact matching):
0
==== unixInit-3.2 FAILED

unixInit.test:  Total   17      Passed  11      Skipped
5       Failed  1
Number of tests skipped for each constraint:
        4       emptyTest
        1       notInstalledInTmp
dgpplain2001-11-19 23:25:10
Logged In: YES 
user_id=80530

On Solaris 8, I see a different error.

==== unixInit-3.2 TclpSetInitialEncodings FAILED
==== Contents of test case:
...
---- Result was:
Couldn't set encoding to '646'
---- Result should have been (exact matching):
0
---- Test generated error; Return code was: 1
---- Return code should have been one of: 0 2
==== unixInit-3.2 FAILED

I see the same underlying fault
causing failures in the tests:

env-2.1
env-2.2
env-2.3
env-2.4
env-3.1
env-4.1
env-4.2
env-4.3
env-4.4
env-4.5
hobbsplain2001-11-20 01:58:05
Logged In: YES 
user_id=72656

The tests will need some updating, and perhaps the 
algorithm used.  If you run the failing test by hand, I see 
on Solaris "couldn't set locale correctly" returned.  This 
is a message from setlocale(3C), not Tcl itself.  This is 
basically saying that japanese is not a valid locale on 
that machine.  This can be confirmed by looking 
at /usr/lib/locale/ and seeing that 'ja' or any japanese 
derivative is not available on my Solaris system.

The question is, is it correct for Tcl to force an encoding 
set, when the underlying system itself can't support it?  I 
believe this is one of the reasons why all the i18n/l10n 
people were telling us to make use of nl_langinfo correctly 
(see Tcl bug 418645).

This also means that the above test should work on Solaris 
with the Japanese extensions.
hobbsplain2001-11-20 16:16:37
Logged In: YES 
user_id=72656

rev 3 of my patch at
https://sourceforge.net/tracker/?
func=detail&aid=418645&group_id=10894&atid=110894 corrects 
this by using the old mechanism as a fallback from the new, 
more "correct" one.  More improvement may be necessary, but 
this should be a strict improvement over what was there.
mkuhnplain2001-11-20 21:23:32
Logged In: YES 
user_id=53799

Very clearly, the test case is broken here and needs to be
removed or fixed. On every system I know, printing a warning
and using the "C" locale when LANG=japanese is indeed the
correct behaviour, because "japanese" is not the name of an
available locale definition file in /usr/lib/locale/.

If you want to turn this into a proper test case, I suggest that

 - you have a list of locale names that you want to test

 - then you check in the output of 'locale -a', which of the
locales for which you have test cases are actually supported
by the libc

 - then you test only these supported ones, and not phantasy
locale names such as "japanese"
Log in (anonymous is fine) to add a comment.