Message ID | 20231107092036.3906764-1-poulhies@adacore.com |
---|---|
State | Accepted |
Headers |
Return-Path: <gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:aa0b:0:b0:403:3b70:6f57 with SMTP id k11csp113176vqo; Tue, 7 Nov 2023 01:25:25 -0800 (PST) X-Google-Smtp-Source: AGHT+IEkd2+ej9gGHeznQLk7uTK+oS/ybtGv1Km9WAnUaznZoscVouyOeZK69RfqanByfV+rQicS X-Received: by 2002:a05:622a:144b:b0:41e:1e0b:a2e7 with SMTP id v11-20020a05622a144b00b0041e1e0ba2e7mr39066454qtx.47.1699349124921; Tue, 07 Nov 2023 01:25:24 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1699349124; cv=pass; d=google.com; s=arc-20160816; b=IowhyIS+Paf0fnWBHSQjt8fQp4fx4ZHG+MHWZRAAgd46Tq0k2m3WCKLKUnbrYrUBxa 07aeSq5X1y47NQlxgyhrfUT3cAzq/wxjBh73DEte8Al0IhPgq4v5RfiOqzocLlQqSfVq ygUW40fwNGMMEZXGBwxKTCnDavfbcrW+qm8qRhstiUE6fBulOQHaXiBmYWIg1IrKrCmY QAFquiljzp0eJ5zAsG3gB4FeigXjkfV26rgYq9jX8iFl3haxM98K4AnE7rcU+KGfcCEm VhnmoJHv9LWsD6iAtZFIb3jFzPM/e0XLdUKOYlOtY0d+g1o+zTHEESXYzaxm09O3xOP1 xs+Q== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:message-id:date:subject:cc:to:from:dkim-signature :arc-filter:dmarc-filter:delivered-to; bh=jltGURpYmlf3VCTX6L9cFIPo+ve3Ecrs4R702SfxHRY=; fh=/LGSvS9fKr8xUSOarN/hPHAOWzvFwgUy+6Y4FjnH2j4=; b=GC6GuwshLdKNqS3hCv70/y8en5ULfzoqytmi5S0Jqw7SvM3etvLtOyaHUvDCzvoovQ xJKaZ3G/o2w/CQGOLp0lc14QkFDKal1IXnmwJd9nNitEQZMu7HJ8bI/cvW6VLD50VwbP 9puNGK3zPbVUup34se88dK+AJpunmSL1SsRp3wB6z2On5UQlHThqFw1tZn3kbsKLeXE8 Ji/VQ4kF/QA5tEX2ZPwcEdlzhAwXz+gkcby9x3k073u5AHCe1ZmR/INFRXnQvynHl4+U GwP06MWCdxf19geIrwSw4RNaVF4WQZEBuDr8fDglFbwYaX6QEKs46UpSOLxBLTYHBLd5 2cwA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@adacore.com header.s=google header.b="ciW+d/DO"; arc=pass (i=1); spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=adacore.com Received: from server2.sourceware.org (server2.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id m9-20020a05622a118900b0041876c7529esi7071133qtk.463.2023.11.07.01.25.24 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Nov 2023 01:25:24 -0800 (PST) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) client-ip=8.43.85.97; Authentication-Results: mx.google.com; dkim=pass header.i=@adacore.com header.s=google header.b="ciW+d/DO"; arc=pass (i=1); spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=adacore.com Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id D4AA2386183A for <ouuuleilei@gmail.com>; Tue, 7 Nov 2023 09:24:51 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-wr1-x433.google.com (mail-wr1-x433.google.com [IPv6:2a00:1450:4864:20::433]) by sourceware.org (Postfix) with ESMTPS id 51554385E00F for <gcc-patches@gcc.gnu.org>; Tue, 7 Nov 2023 09:20:40 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 51554385E00F Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=adacore.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=adacore.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 51554385E00F Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a00:1450:4864:20::433 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1699348841; cv=none; b=NgQnDbh9SXADa8xYVMeryJtGFGYC/4lxgY8mqMyIOYQG6VdWA7dgNxL4qzC3pFqxENg1WaVMup9WDBwQq6wXmkHakZ/62QYsGtuVbM9o0iAIdVnlCBhC5rIXbX4cS8n6bTRfDoXL5qaP0JB3y5Ga7AQ1HnLW7OYnPZkYy5LhsYc= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1699348841; c=relaxed/simple; bh=1vC8EoxSkrGfemVDpjPvDKBjIaeiE0NZClWjXz0nxks=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=mjRugGq3zCzAxFhAEPoWWorcpkpy4/7KjGJKuYi1HtCHO0wAyN1e5qhlnkmxwMKhVzkMsZG2Tlo8FyH/rVHKBhEZ0AlVk1+rsZPGVF5XRcSi3Vu8VkawAgWsGguC+eRNsAZgEkDQeB3Nlhgk1TMEdhgDaW6z+mAo8RMohyZgK6U= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-wr1-x433.google.com with SMTP id ffacd0b85a97d-32f87b1c725so3766365f8f.3 for <gcc-patches@gcc.gnu.org>; Tue, 07 Nov 2023 01:20:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adacore.com; s=google; t=1699348839; x=1699953639; darn=gcc.gnu.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=jltGURpYmlf3VCTX6L9cFIPo+ve3Ecrs4R702SfxHRY=; b=ciW+d/DOvTX9cvgEN/ySa4v80cyM211jlluPSz0ypvxW3tkblAXRKW59BfPyrXvvXH ARWaj068TrmfHGNn2PPh7pMlOC7XsOHLbEUI99lJ8LRw0DIrjIhs9llVlAYJegoMDzI0 xhaItQ4rKDpQ9WmXFVsefwkwydPey1uXgBQZcmaeZKbwC47b+9Dcng5XQ/yGZZdtcnJT FwuP+2b0U5PpEmunWOms8eRjBfFtMHAl1X27qLvh3GtFfckaHCTvemlHIWoIz6T+1wlX LRccMrJKYB8A7lEQzSYIBbqqmMHgVKPOGM+sioYlWJaW/bYOu+eSUK7Te2UUyLDNoklN hzAA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1699348839; x=1699953639; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=jltGURpYmlf3VCTX6L9cFIPo+ve3Ecrs4R702SfxHRY=; b=crx7hZK+Xk1QDWpcjH9VfzxTPca5Mec0lU1lsPtNGIN+z4Rw+9ev2EpqD9NOfKzm2p DpMSyMpca/VSueSRCUMAZmm6n9jvMhCn2QkZSjKNbcU2qFiGRxocIENeemXYKFPjlXUc pOXoEq5wOgMKbSF2LG+AMc0U4CQGcQBkIOCeCrh1fqWUgkLcF9YlX2A6V+IrB2K61p+n aHktXcl5d33dyjQSA9BSxy2yxN0b8dQPOJjE1Yix9N8nAWU3lU8wFjTd3GcoRqQbojyW UjzhRXRik4RSKvc15rTmhqnhAWD0D6mFNB+6y4ksJgFBxTmBAlKPCkzG9dSjWYuYB/gO JRMw== X-Gm-Message-State: AOJu0YwBjGOUOIxE20lOVPYjRfEhCCVL/mFUchYYGvrRYM3YlqJBWYIo u7Hx3cWZb+yCa2HywQ3IO6+vGvt5Zs7yZJyKghAmzg== X-Received: by 2002:a05:6000:144e:b0:32f:7fb1:66d9 with SMTP id v14-20020a056000144e00b0032f7fb166d9mr21738947wrx.21.1699348839203; Tue, 07 Nov 2023 01:20:39 -0800 (PST) Received: from localhost.localdomain ([2001:861:3382:1a90:dbc1:a1d1:2e58:4040]) by smtp.gmail.com with ESMTPSA id z16-20020a5d44d0000000b00317a04131c5sm1778937wrr.57.2023.11.07.01.20.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Nov 2023 01:20:38 -0800 (PST) From: =?utf-8?q?Marc_Poulhi=C3=A8s?= <poulhies@adacore.com> To: gcc-patches@gcc.gnu.org Cc: Ronan Desplanques <desplanques@adacore.com> Subject: [COMMITTED] ada: Fix Ada.Directories.Modification_Time on Windows Date: Tue, 7 Nov 2023 10:20:36 +0100 Message-ID: <20231107092036.3906764-1-poulhies@adacore.com> X-Mailer: git-send-email 2.42.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-13.7 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gcc-patches mailing list <gcc-patches.gcc.gnu.org> List-Unsubscribe: <https://gcc.gnu.org/mailman/options/gcc-patches>, <mailto:gcc-patches-request@gcc.gnu.org?subject=unsubscribe> List-Archive: <https://gcc.gnu.org/pipermail/gcc-patches/> List-Post: <mailto:gcc-patches@gcc.gnu.org> List-Help: <mailto:gcc-patches-request@gcc.gnu.org?subject=help> List-Subscribe: <https://gcc.gnu.org/mailman/listinfo/gcc-patches>, <mailto:gcc-patches-request@gcc.gnu.org?subject=subscribe> Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1781896707819003732 X-GMAIL-MSGID: 1781896707819003732 |
Series |
[COMMITTED] ada: Fix Ada.Directories.Modification_Time on Windows
|
|
Checks
Context | Check | Description |
---|---|---|
snail/gcc-patch-check | success | Github commit url |
Commit Message
Marc Poulhiès
Nov. 7, 2023, 9:20 a.m. UTC
From: Ronan Desplanques <desplanques@adacore.com>
Before this patch, Ada.Directories.Modification_Time called
GetFileAttributesExA under the hood on Windows. That would sometimes
fail to work with files whose names were non-ASCII.
This patch replaces the call to GetFileAttributesExA with a call to
GetFileAttributesEx preceded by an encoding scheme conversion, as is
done in other functions of the run-time library. This fixes the issues
that were observed with the previous implementations.
gcc/ada/
* adaint.c (__gnat_file_time): Fix Windows version.
Tested on x86_64-pc-linux-gnu, committed on master.
---
gcc/ada/adaint.c | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/gcc/ada/adaint.c b/gcc/ada/adaint.c index 2a193efc002..bb4ed2607e5 100644 --- a/gcc/ada/adaint.c +++ b/gcc/ada/adaint.c @@ -1507,7 +1507,16 @@ extern long long __gnat_file_time(char* name) long long ll_time; } t_write; - if (!GetFileAttributesExA(name, GetFileExInfoStandard, &fad)) { + TCHAR wname [GNAT_MAX_PATH_LEN + 2]; + int name_len; + + S2WSC (wname, name, GNAT_MAX_PATH_LEN + 2); + name_len = _tcslen (wname); + + if (name_len > GNAT_MAX_PATH_LEN) + return LLONG_MIN; + + if (!GetFileAttributesEx(wname, GetFileExInfoStandard, &fad)) { return LLONG_MIN; }