From patchwork Fri Oct 26 17:50:17 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ian Lance Taylor X-Patchwork-Id: 194549 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) by ozlabs.org (Postfix) with SMTP id 1C0C82C0093 for ; Sat, 27 Oct 2012 04:50:30 +1100 (EST) Comment: DKIM? See http://www.dkim.org DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=gcc.gnu.org; s=default; x=1351878631; h=Comment: DomainKey-Signature:Received:Received:Received:Received:Received: Received:From:To:Cc:Subject:Date:Message-ID:User-Agent: MIME-Version:Content-Type:Mailing-List:Precedence:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:Sender: Delivered-To; bh=b3mBRgSJ78Z4v1SgN8ZV8B2RG0A=; b=dH0i7wOCVRBdQ7P T0HaPB1NshHJuyhkJtVmNA5QRoi+b9q90HPOur0NTaGE7DemMg4o7ANL/HzbpVY1 OPCrLNbc8uTXqxguJtJ1cHu4CRCe2C3o79qfIjB11k1k3bipcBcHwonUotcLIUzI tUFRXXvjRrMmbf6VEX1pSm0xUnjE= Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=default; d=gcc.gnu.org; h=Received:Received:X-SWARE-Spam-Status:X-Spam-Check-By:Received:Received:X-Google-DKIM-Signature:Received:Received:From:To:Cc:Subject:Date:Message-ID:User-Agent:MIME-Version:Content-Type:X-Gm-Message-State:X-IsSubscribed:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=NGl3JSPkK2wExPA6euSVg4ajOqoM1zGfkd2XyEZRnaVxIXPfnScRNAGHho6X3s Nd0+JgPy3uFuqtWzrp5LjmgZND9gM9BdRjMCveVLYkizMNJWCru8WkYdeUzlgs1q CNtDNftvOwg8yTJwqvJXOTY2rZyS9KzHCgDz/qNWs5aeg=; Received: (qmail 28269 invoked by alias); 26 Oct 2012 17:50:26 -0000 Received: (qmail 28255 invoked by uid 22791); 26 Oct 2012 17:50:26 -0000 X-SWARE-Spam-Status: No, hits=-5.2 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, KHOP_RCVD_TRUST, RCVD_IN_DNSWL_LOW, RCVD_IN_HOSTKARMA_YE, RP_MATCHES_RCVD, T_FRT_STOCK2, T_TVD_MIME_NO_HEADERS X-Spam-Check-By: sourceware.org Received: from mail-pa0-f47.google.com (HELO mail-pa0-f47.google.com) (209.85.220.47) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 26 Oct 2012 17:50:19 +0000 Received: by mail-pa0-f47.google.com with SMTP id fa11so1992779pad.20 for ; Fri, 26 Oct 2012 10:50:19 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=from:to:cc:subject:date:message-id:user-agent:mime-version :content-type:x-gm-message-state; bh=5bVmHlsYjNz8Y99Xg/Jw9WeIM3/uUwce75TBlEkBDVo=; b=Om8r+fKecVzoBTRmBH/bAYnYGjyvNdI4pjbCr0KnqZr2UCdHS92UTg5aDplAryIY6v aJIek4zaCl42CW3TmB65WDjugU7AuMflfm0BukXxkxJ9ivksOKH9+sor4cdn9e32DDLX rvkirw+T1iu8Tym2RSFkCH8iOqjv8xdRyKHTyutQYlG5OG5ptESIyDabFN66DddNSKwM wArb0a+7r7JlCm+Oy7eY8V380ZMbPNnOgSxC+i9iCgYXgBg1r+F5F45DuSw7mhzhuAdG nCwOu1TX9cL+r0SyKTLNXYkqmAQGiacEu0KFZW/fYV/CgGCzXrLBWrd0dE+Qvro/GGbP qK9g== Received: by 10.68.218.226 with SMTP id pj2mr72312702pbc.33.1351273818979; Fri, 26 Oct 2012 10:50:18 -0700 (PDT) Received: from coign.google.com ([2620:0:1000:1804:224:d7ff:fe8f:f634]) by mx.google.com with ESMTPS id uk9sm1480665pbc.63.2012.10.26.10.50.17 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 26 Oct 2012 10:50:18 -0700 (PDT) From: Ian Lance Taylor To: gcc-patches@gcc.gnu.org, gofrontend-dev@googlegroups.com Cc: Uros Bizjak Subject: libgo patch committed: Fix test Date: Fri, 26 Oct 2012 10:50:17 -0700 Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) MIME-Version: 1.0 X-Gm-Message-State: ALoCoQm+9SVNF5MImP3zh/oNaTcoWb0oztB665nGo1+SjftjSmVvNrs7K6zI+c23yt/tABV9Y+u7XNtzLf1Nu0akanmPIi3q2XNLNzfjq2LiL0/dUrggqzfntjN3XRItaH7/h1AvDtRx4nZo0vFBoEHeCqmt7VAbLRrY6xxwYTRcV+r7weDQTexsj1SbvO4WwBBbPelXnkiM X-IsSubscribed: yes Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Uros investigated a libgo testsuite failure on Alpha GNU/Linux that looked like a GC bug but turned out to simply be a testsuite bug. In Go when the garbage collector collects an os.File it closes the file descriptor. The syscall/creds_test test would call socketpair(), and defer closing both descriptors. Then it would turn the file descriptors into os.File pointers using os.NewFile, but it would not close those os.File pointers. So when the test returned, the file descriptors would be closed, but the os.File pointers would remain in the heap, inaccessible. When the garbage collector noticed that, it would run the finalizers, and close the descriptors again. That is normally harmless, as the finalizer ignored the errors. However, in this case a later test would call socketpair again and happened to get the same file descriptor numbers back. Then the garbage collector ran, and closed them before the test was complete. So the test failed. This patch fixes the problem. Test ran on x86_64-unknown-linux-gnu. Committed to mainline. Ian diff -r 158890b70d33 libgo/go/syscall/creds_test.go --- a/libgo/go/syscall/creds_test.go Thu Oct 25 11:25:35 2012 -0700 +++ b/libgo/go/syscall/creds_test.go Fri Oct 26 10:38:15 2012 -0700 @@ -31,14 +31,18 @@ t.Fatalf("SetsockoptInt: %v", err) } - srv, err := net.FileConn(os.NewFile(uintptr(fds[0]), "")) + srvFile := os.NewFile(uintptr(fds[0]), "server") + defer srvFile.Close() + srv, err := net.FileConn(srvFile) if err != nil { t.Errorf("FileConn: %v", err) return } defer srv.Close() - cli, err := net.FileConn(os.NewFile(uintptr(fds[1]), "")) + cliFile := os.NewFile(uintptr(fds[1]), "client") + defer cliFile.Close() + cli, err := net.FileConn(cliFile) if err != nil { t.Errorf("FileConn: %v", err) return