Bug 114454 - go.test/test/fixedbugs/issue27836.go FAILs with LANG=C
Summary: go.test/test/fixedbugs/issue27836.go FAILs with LANG=C
Status: UNCONFIRMED
Alias: None
Product: gcc
Classification: Unclassified
Component: go (show other bugs)
Version: 14.0
: P3 normal
Target Milestone: ---
Assignee: Ian Lance Taylor
URL:
Keywords: testsuite-fail
Depends on:
Blocks:
 
Reported: 2024-03-25 11:04 UTC by Rainer Orth
Modified: 2024-08-04 23:35 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Rainer Orth 2024-03-25 11:04:21 UTC
When running the Go testsuite with LANG=C (or any non-UTF-8 locale, I suppose),
go.test/test/fixedbugs/issue27836.go FAILs:

FAIL: go.test/test/fixedbugs/issue27836.dir/Äfoo.go  -O -I. (test for excess errors)

Excess errors:
go1: fatal error: cannot open /vol/gcc/src/hg/master/local/gcc/testsuite/go.test/test/fixedbugs/issue27836.dir/Ã<84>foo.go: No such file or directory
compilation terminated.

FAIL: go.test/test/fixedbugs/issue27836.dir/Ämain.go  -O -I. (test for excess errors)

Excess errors:
go1: fatal error: cannot open /vol/gcc/src/hg/master/local/gcc/testsuite/go.test/test/fixedbugs/issue27836.dir/Ã<84>main.go: No such file or directory
compilation terminated.

It seems the test assumes an UTF-8 locale, but takes no precautions to guarantee
that.
Comment 1 Ian Lance Taylor 2024-03-27 18:51:03 UTC
I'm not sure what is going on here.  The test as such does not require a UTF-8 LANG.  That is, I can run the compiler and the test with LANG=C and everything passes.  In fact, that is exactly how the GCC testsuite runs the test: the GCC testsuite sets LANG=C before all tests.

As best I can tell the problem must be arising somehow in the DejaGNU code.  The filenames in the test use UTF-8 non-ASCII characters.  But I haven't been able to figure out where the problem is.
Comment 2 Hans-Peter Nilsson 2024-03-29 23:57:12 UTC
This reminds me of PR105959, but no, I haven't actually jumped into the rabbithole^W^Wanalyzed the problem to any extent.
Comment 3 ro@CeBiTec.Uni-Bielefeld.DE 2024-04-04 12:00:42 UTC
> --- Comment #1 from Ian Lance Taylor <ian at airs dot com> ---
> I'm not sure what is going on here.  The test as such does not require a UTF-8
> LANG.  That is, I can run the compiler and the test with LANG=C and everything
> passes.  In fact, that is exactly how the GCC testsuite runs the test: the GCC
> testsuite sets LANG=C before all tests.
>
> As best I can tell the problem must be arising somehow in the DejaGNU code. 
> The filenames in the test use UTF-8 non-ASCII characters.  But I haven't been
> able to figure out where the problem is.

I've done a bit more digging now, running the test under runtest both
with LANG=en_US.UTF-8 and LANG=C.

* Comparing go.log shows

-PASS: go.test/test/fixedbugs/issue27836.dir/�<84>foo.go  -O -I. (test for excess errors)
+go1: fatal error: cannot open /vol/gcc/src/hg/master/local/gcc/testsuite/go.test/test/fixedbugs/issue27836.dir/�<83>�<84>foo.go: No such file or directory

  i.e. a leading "�<83>" is added to the filename.

* Running both under truss, I see that gccgo is invoked differently:

  LANG=UTF-8:

14285:  execve("/var/gcc/regression/master/11.4-gcc/build/gcc/testsuite/go-issue27836/../../gccgo", 0x00E00790, 0x009A5F10)  argc = 12
14285:   argv:
14285:    /var/gcc/regression/master/11.4-gcc/build/gcc/testsuite/go-issue27836/../../gccgo
14285:    -B/var/gcc/regression/master/11.4-gcc/build/gcc/testsuite/go-issue27836/../../
14285:    -fdiagnostics-plain-output
14285:    -I/var/gcc/regression/master/11.4-gcc/build/i386-pc-solaris2.11/./libgo
14285:    -O -I. -w -pedantic-errors -c -o Ã<84>foo.o
14285:    /vol/gcc/src/hg/master/local/gcc/testsuite/go.test/test/fixedbugs/issue27836.dir/Ã<84>foo.go

  LANG=C:

14441:  execve("/var/gcc/regression/master/11.4-gcc/build/gcc/testsuite/go-issue27836/../../gccgo", 0x00DFFA40, 0x009A11A0)  argc = 12
14441:   argv:  
14441:    /var/gcc/regression/master/11.4-gcc/build/gcc/testsuite/go-issue27836/../../gccgo
14441:    -B/var/gcc/regression/master/11.4-gcc/build/gcc/testsuite/go-issue27836/../../
14441:    -fdiagnostics-plain-output
14441:    -I/var/gcc/regression/master/11.4-gcc/build/i386-pc-solaris2.11/./libgo
14441:    -O -I. -w -pedantic-errors -c -o Ã<83>Â<84>foo.o
14441:    /vol/gcc/src/hg/master/local/gcc/testsuite/go.test/test/fixedbugs/issue27836.dir/Ã<83>Â<84>foo.go

So the caller of gccgo (runtest/expect) calls it differently.

runtest is the latest version:

DejaGnu version	1.6.3
Expect version	5.45.4
Tcl version	8.6

but expect is ancient (the latest available from 2018).

My inclination to debug runtest or even expect is limited, TBH.
Comment 4 Andreas Schwab 2024-04-04 12:29:52 UTC
<c3><83> is the UTF-8 encoding of U00C3 and <c2><84> is the UTF-8 encoding of U0084.