From patchwork Fri Mar 9 14:55:06 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnaud Charlet X-Patchwork-Id: 145725 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 F3F5EB6F13 for ; Sat, 10 Mar 2012 01:55:25 +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=1331909726; h=Comment: DomainKey-Signature:Received:Received:Received:Received:Received: Received:Received:Date:From:To:Cc:Subject:Message-ID: MIME-Version:Content-Type:Content-Disposition:User-Agent: Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:Sender:Delivered-To; bh=SU43BVrfu/gFy2Xy2mD1 QrYCvh4=; b=ienOscpSsoSayeacMsipzrMb+D4X3q0MXoRuOWAnVBVjmjD7RWUT ltzakx4oQtfh/Z8pZ4g8A07MoZD6b4M0k+onsDn3oo2U6f5iMNDzHCUYF8273fxq nKs8SYTtjrIB9EVLE+XVGnQqFB7YtQh+GEExwaaFxQUnFLPA5pRp7UU= 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:Received:Received:Received:Date:From:To:Cc:Subject:Message-ID:MIME-Version:Content-Type:Content-Disposition:User-Agent:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=MapXeQrazMWJrq0ceg4czr+6l5oJVmbKwJEoPyKhrPmUCT4dDULGsFReRA+y84 CsPYEmegkqUi1E4KLdHZIm0kzL9BoJF85vwSVK5j04kaJV/ZF+3JmCQNz1viTH8f wwSrpP99mKkZ1pIB65QsP4iFeQETFMfnipnndyp039vYk=; Received: (qmail 8324 invoked by alias); 9 Mar 2012 14:55:21 -0000 Received: (qmail 8315 invoked by uid 22791); 9 Mar 2012 14:55:20 -0000 X-SWARE-Spam-Status: No, hits=-1.8 required=5.0 tests=AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from rock.gnat.com (HELO rock.gnat.com) (205.232.38.15) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 09 Mar 2012 14:55:07 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by filtered-rock.gnat.com (Postfix) with ESMTP id BED921C64DE; Fri, 9 Mar 2012 09:55:06 -0500 (EST) Received: from rock.gnat.com ([127.0.0.1]) by localhost (rock.gnat.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id bhvwjX7FLKxa; Fri, 9 Mar 2012 09:55:06 -0500 (EST) Received: from kwai.gnat.com (kwai.gnat.com [205.232.38.4]) by rock.gnat.com (Postfix) with ESMTP id 31B311C6564; Fri, 9 Mar 2012 09:55:06 -0500 (EST) Received: by kwai.gnat.com (Postfix, from userid 4192) id 31EC73FEE8; Fri, 9 Mar 2012 09:55:06 -0500 (EST) Date: Fri, 9 Mar 2012 09:55:06 -0500 From: Arnaud Charlet To: gcc-patches@gcc.gnu.org Cc: Vasiliy Fofanov Subject: [Ada] Fix Current_Directory behavior for root dirs on Windows Message-ID: <20120309145506.GA5793@adacore.com> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.20 (2009-06-14) 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 Current_Directory incorrectly returned the path of the form "X:" instead of "X:\" Manually tested on i686-pc-mingw32. Tested on x86_64-pc-linux-gnu, committed on trunk 2012-03-09 Vasiliy Fofanov * a-direct.adb: Do not strip the trailing directory separator from path, as this is already done inside Normalize_Pathname; doing it again produces the wrong result on Windows for the drive's root dir (i.e. "X:\" becomes "X:"). Index: a-direct.adb =================================================================== --- a-direct.adb (revision 185136) +++ a-direct.adb (working copy) @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 2004-2011, Free Software Foundation, Inc. -- +-- Copyright (C) 2004-2012, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -514,18 +514,10 @@ begin Local_Get_Current_Dir (Buffer'Address, Path_Len'Address); - declare - -- We need to resolve links because of A.16(47), since we must not - -- return alternative names for files - Cur : constant String := Normalize_Pathname (Buffer (1 .. Path_Len)); + -- We need to resolve links because of A.16(47), since we must not + -- return alternative names for files + return Normalize_Pathname (Buffer (1 .. Path_Len)); - begin - if Cur'Length > 1 and then Cur (Cur'Last) = Dir_Separator then - return Cur (1 .. Cur'Last - 1); - else - return Cur; - end if; - end; end Current_Directory; ----------------------