[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [GNU Autoconf 2.69.59-adc84] testsuite: 132 355 failed
From: |
Stefano Lattarini |
Subject: |
Re: [GNU Autoconf 2.69.59-adc84] testsuite: 132 355 failed |
Date: |
Wed, 02 Jan 2013 17:03:08 +0100 |
On 01/01/2013 02:40 PM, Stefano Lattarini wrote:
>
> I can reproduce the same error with Autoconf 2.69 and the following
> minimal configure.ac:
>
> AC_INIT([test-go], [1.0])
> AC_PROG_GO
> AC_OUTPUT
>
> It's not a quoting issue in ./configure, but an error in the Go
> program that ./configure tries to compile:
>
> package main
> import ( "fmt"; "os" )
> func main() {
> f, err := os.Open("conftest.out", os.O_CREATE|os.O_WRONLY, 0777)
> if err != nil {
> fmt.Println(err)
> os.Exit(1)
> }
> if err = f.Close(); err != nil {
> fmt.Println(err)
> os.Exit(1)
> }
> os.Exit(0)
> }
>
> According to <http://golang.org/pkg/os/#Open>, the above snippet
> is using 'os.Open' with the wrong number of arguments. I believe
> the best fix would be using the 'os.OpenFile' function instead:
> <http://golang.org/pkg/os/#OpenFile>
>
> I might attempt a patch today or tomorrow; if anyone wants to
> beat me, please be my guest :-)
>
Here it is. OK to push?
Regards,
Stefano
---- 8< ---- 8< ---- 8< ---- 8< ---- 8< ---- 8< ---- 8< ---- 8< ---- 8< ----
>From 86303c200e52f75b678129a6833b82d565f72a1e Mon Sep 17 00:00:00 2001
Message-Id: <address@hidden>
From: Stefano Lattarini <address@hidden>
Date: Wed, 2 Jan 2013 17:01:05 +0100
Subject: [PATCH] go: fix checks for about I/O functions
Reference:
<http://lists.gnu.org/archive/html/bug-autoconf/2013-01/msg00000.html>
* lib/autoconf/go.m4 (_AC_LANG_IO_PROGRAM(Go), AC_LANG_INT_SAVE): Here,
correctly using 'os.OpenFile()' <http://golang.org/pkg/os/#OpenFile>
rather than 'os.Open()' <http://golang.org/pkg/os/#Open> (which has
more restricted semantics and and incompatible signature).
Signed-off-by: Stefano Lattarini <address@hidden>
---
lib/autoconf/go.m4 | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/lib/autoconf/go.m4 b/lib/autoconf/go.m4
index bf215bf..bf1a4ae 100644
--- a/lib/autoconf/go.m4
+++ b/lib/autoconf/go.m4
@@ -61,7 +61,7 @@ $2
# Produce source that performs I/O.
m4_define([_AC_LANG_IO_PROGRAM(Go)],
[AC_LANG_PROGRAM([import ( "fmt"; "os" )],
-[f, err := os.Open("conftest.out", os.O_CREATE|os.O_WRONLY, 0777)
+[f, err := os.OpenFile("conftest.out", os.O_CREATE|os.O_WRONLY, 0777)
if err != nil {
fmt.Println(err)
os.Exit(1)
@@ -107,7 +107,7 @@ import (
"os"
)
],
-[f, err := os.Open("conftest.val", os.O_CREATE|os.O_WRONLY, 0777)
+[f, err := os.OpenFile("conftest.val", os.O_CREATE|os.O_WRONLY, 0777)
if err != nil {
os.Exit(1)
}
--
1.8.1.rc3.27.g3b73c7d