From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wr1-x42a.google.com (mail-wr1-x42a.google.com [IPv6:2a00:1450:4864:20::42a]) by sourceware.org (Postfix) with ESMTPS id B7D68385783D for ; Thu, 8 Jul 2021 08:53:24 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org B7D68385783D Received: by mail-wr1-x42a.google.com with SMTP id i8so6477307wrp.12 for ; Thu, 08 Jul 2021 01:53:24 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=Bhz15JVNK2RoJWzlgSUBwfE6N32yhAzu/G1RuZSnL70=; b=o9kqcCgSCatpHACiCNRgrjqXtmE8Cdj+5OI8PfJjHU9go807Hpu89S2INMnHo0Sdy7 zDSxSub76CEcgdQZzCyun+BODgPDhi1ZsUdmQHHdCIWUu9bdJum4jOjTYdAfH/y/E54V Upvu27HI0MMNIqtYBeQwDL72byWPnPx7t0TDIV3TPL0kG3eDhj7XNJwi0FVZFK9FRIDi m8SZWDYNXEFXSPGK2EuOmVwozHLoyJN90QAsVw5eihxd/h8O0icAM0N3fxQD3yVG8BXR 1BSGGATelb8JkjcrLWOEei6szbKgQuXXnksA+kO5C/gBeZtwDH+FnT2kIL34r9Ai5LwO Zsvg== X-Gm-Message-State: AOAM530cyqD0umSmRa+5vnQ4YrtR/GWDF8Vk47osKiWRiw8tpJPCCwoq MVArr29c8MAHYlwvIvc1B5rBIv7ZQYuwKq4En/E= X-Google-Smtp-Source: ABdhPJyxDc3aNoYBcex8FWrk63LsyF+G/zH56KYUADcn3QEM9tXHx8hi2TotHrZNYTLTGnAMjXYtCEkG6oxIH0v91Uc= X-Received: by 2002:a5d:684f:: with SMTP id o15mr32545873wrw.134.1625734403259; Thu, 08 Jul 2021 01:53:23 -0700 (PDT) MIME-Version: 1.0 References: <_022Gh93RaZBX0JIf3f3UuZ7mekqKNi9g4ap-KHKpAa_ppq6O8Y3WXBDUUCw6yK6KJCdfhrFhwGfbB-UZD5R0wmWa2Lo6ZE6glWt4JzyDns=@protonmail.com> In-Reply-To: <_022Gh93RaZBX0JIf3f3UuZ7mekqKNi9g4ap-KHKpAa_ppq6O8Y3WXBDUUCw6yK6KJCdfhrFhwGfbB-UZD5R0wmWa2Lo6ZE6glWt4JzyDns=@protonmail.com> From: Csaba Raduly Date: Thu, 8 Jul 2021 10:53:09 +0200 Message-ID: Subject: Re: fstream::open crashes if first file it ever opening is in /proc To: Max Mikhanosha Cc: "cygwin@cygwin.com" Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-1.2 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: cygwin@cygwin.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: General Cygwin discussions and problem reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 08 Jul 2021 08:53:26 -0000 On Thu, 8 Jul 2021 at 07:42, Max Mikhanosha via Cygwin wrote: > > Fully updated Windows 10, with freshly downloaded Cygwin. > > trying to compile google/benchmark does not work coz it can't read /proc/cpuinfo > > Reduced test test program > > #include > #include > > int main (int argc, char **argv) > { > if (argc > 1) > { > std::fstream booya ("whatever"); > } > std::fstream f("/proc/cpuinfo"); > if (!f.is_open ()){ > std::cout << "Unable to open /proc/cpuinfo" << std::endl; > } > return 0; > } > > Repro log > > > user@MARS ~ > $ g++ blah.cc > > user@MARS ~ > $ ./a.exe # this does not work > Unable to open /proc/cpuinfo > > user@MARS ~ > $ ./a.exe foobar # this works > Works just fine for me (I added code to read the first word from the stream and print it) Csaba@AMDAHL ~ $ ./a.exe processor Csaba@AMDAHL ~ $ ./a.exe foobar processor Csaba -- You can get very substantial performance improvements by not doing the right thing. - Scott Meyers, An Effective C++11/14 Sampler So if you're looking for a completely portable, 100% standards-conformant way to get the wrong information: this is what you want. - Scott Meyers (C++TDaWYK)