From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pf1-x42b.google.com (mail-pf1-x42b.google.com [IPv6:2607:f8b0:4864:20::42b]) by sourceware.org (Postfix) with ESMTPS id A66943858D1E for ; Sat, 11 Mar 2023 20:18:23 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org A66943858D1E Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-pf1-x42b.google.com with SMTP id bd34so5590013pfb.3 for ; Sat, 11 Mar 2023 12:18:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1678565902; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=efza69VI6yq4Rc+fXSEnF6GlNIc1S65uJ7OW4AJvU0I=; b=TYsIrvfUusrTHtY7rqRMOpYwzID0yy/rsIt+c6VkZYXufbHaNkE2B8hRHn4yfN47dE KHu973aVxJ9hnncGCJFXOZUHn5fyw1oCkm0jQuYPK3rzRcBF5r9FtVEL9Rc3X5nIhwHX sEmlCDp6W6G/SZ4iM0k5n6fvBHxdfLCfZD31gyucBv5zn08+M/7C2qsu5SLSHpwAruUi YV0dPZXWu+UJG1RKdmkmymCJYu/4saW1DsQNjFKQZve4h5JctfAQ7nfysGdaqQY+AtIu BUIGZdJJ1+E4gNoMgLmBBuA47fLxH1JMdzfId9MuFecdnLsc0gBK5SrLaVMFNSuGduhD 7G7Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678565902; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=efza69VI6yq4Rc+fXSEnF6GlNIc1S65uJ7OW4AJvU0I=; b=esj/OxNPk/Y95gzvD376HkC0bLEOkCkOnlzcaIq7hwDWO7pkN6FPvsjZWgOltNjFBy sA1PqWYd7qnRvrbfT7qsTbbh8QjCUixGg7cfmwYXU/CBXcaMsZCeidN3TlBHV3hlF4YH qHJGITL5LIlJTmgPO6H8VLy7ybWZ46DN9AHgJgup7cAdA04pnzK4Fli1qT3xtN0qLqbx mJ7POhVT4Zs8Bu3NncH8J2f+fG95Z1SgQd++F4GbOBoYUWGBcWBEm0TB0uA8hYHzVXAt YICnuhBgh/b+h/yK2VA4y33DrRO7n/X0iOK4+xW0CiBwZ3QA1l86joLs/b7M9ExYBgSo j6fw== X-Gm-Message-State: AO0yUKXWTeUs2dY2jIWtu8EZkgjjTr3u+CoWehiqn7IxKe2AUhSbAd4o E84BjP4qR4hHZ95D0eSSmcI= X-Google-Smtp-Source: AK7set88HzO+aKdjeH5gIcidrs80wkp9hxJvoIEZcI9+imUhnUSoufOndFgTzmVK/1OopH9DAzAXYQ== X-Received: by 2002:a62:38c4:0:b0:622:6bfd:a87e with SMTP id f187-20020a6238c4000000b006226bfda87emr2213409pfa.17.1678565902497; Sat, 11 Mar 2023 12:18:22 -0800 (PST) Received: from ?IPV6:2601:681:8600:13d0::f0a? ([2601:681:8600:13d0::f0a]) by smtp.gmail.com with ESMTPSA id a10-20020a62bd0a000000b00593e84f2d08sm1844776pff.52.2023.03.11.12.18.21 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 11 Mar 2023 12:18:21 -0800 (PST) Message-ID: <1ef2828b-c316-348d-9796-92b872c96e3c@gmail.com> Date: Sat, 11 Mar 2023 13:18:20 -0700 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.8.0 Subject: Re: [PATCH] Handle Windows nul device in unlink-if-ordinary.c Content-Language: en-US To: anothername27-unity@yahoo.com, gcc-patches@gcc.gnu.org Cc: Himal References: <20230106083118.2141-1-anothername27-unity@yahoo.com> From: Jeff Law In-Reply-To: <20230106083118.2141-1-anothername27-unity@yahoo.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-8.4 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,GIT_PATCH_0,NICE_REPLY_A,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On 1/6/23 01:31, anothername27-unity--- via Gcc-patches wrote: > From: Himal > > Hi, > > This might be a better fix. > > Regards. > > PS. I had to use a different email. > > --- > libiberty/unlink-if-ordinary.c | 6 ++++++ > 1 file changed, 6 insertions(+) > > diff --git a/libiberty/unlink-if-ordinary.c b/libiberty/unlink-if-ordinary.c > index 84328b216..e765ac8b1 100644 > --- a/libiberty/unlink-if-ordinary.c > +++ b/libiberty/unlink-if-ordinary.c > @@ -62,6 +62,12 @@ was made to unlink the file because it is special. > int > unlink_if_ordinary (const char *name) > { > +/* MS-Windows 'stat' function (and in turn, S_ISREG) > + reports the null device as a regular file. */ > +#ifdef _WIN32 > + if (stricmp (name, "nul") == 0) > + return 1; > +#endif Umm, wouldn't this return true for a real file called nul in the current directory? ie, don't you need to distinguish between the nul device and a file named nul based on the full path? And not being a windows person, I'd really like to see some documentation which indicates that stat on the null device will indicate its a regular file. Alternately if one of the windows experts here can chime in, it'd be appreciated. jeff