| www.delorie.com/archives/browse.cgi | search |
| X-Recipient: | archive-cygwin AT delorie DOT com |
| DKIM-Filter: | OpenDKIM Filter v2.11.0 sourceware.org E1BC1397EC2C |
| DKIM-Signature: | v=1; a=rsa-sha256; c=relaxed/relaxed; d=cygwin.com; |
| s=default; t=1625722980; | |
| bh=4r9nP75HQ0wzxMd+W+DeZl8nlZiAlbXeluv9Gy/XDw4=; | |
| h=Date:To:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: | |
| List-Help:List-Subscribe:From:Reply-To:From; | |
| b=Ccy45s6oWyvAvW8L8p02j+y5Zd87OO5CBQ7AhQ06r8QUYk1J7LXJC7HteScoqB/MN | |
| PM2CEWgKyMWXA2yYV2OKFqbY/ZZhPnhjJKx+/Uz2hhU/MPObyp7hwrYvvtemi/o3h0 | |
| hgw3AHueSjjoCR2+ZHOsKcTBpkgk3bTmFUCTE+oE= | |
| X-Original-To: | cygwin AT cygwin DOT com |
| Delivered-To: | cygwin AT cygwin DOT com |
| DMARC-Filter: | OpenDMARC Filter v1.4.1 sourceware.org 311BA383B825 |
| Date: | Thu, 08 Jul 2021 05:41:40 +0000 |
| To: | "cygwin AT cygwin DOT com" <cygwin AT cygwin DOT com> |
| Subject: | fstream::open crashes if first file it ever opening is in /proc |
| Message-ID: | <_022Gh93RaZBX0JIf3f3UuZ7mekqKNi9g4ap-KHKpAa_ppq6O8Y3WXBDUUCw6yK6KJCdfhrFhwGfbB-UZD5R0wmWa2Lo6ZE6glWt4JzyDns=@protonmail.com> |
| MIME-Version: | 1.0 |
| X-Spam-Status: | No, score=-2.5 required=5.0 tests=BAYES_00, DKIM_SIGNED, |
| DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, RCVD_IN_MSPIKE_H3, | |
| RCVD_IN_MSPIKE_WL, SPF_HELO_PASS, 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 AT cygwin DOT com |
| X-Mailman-Version: | 2.1.29 |
| List-Id: | General Cygwin discussions and problem reports <cygwin.cygwin.com> |
| List-Archive: | <https://cygwin.com/pipermail/cygwin/> |
| List-Post: | <mailto:cygwin AT cygwin DOT com> |
| List-Help: | <mailto:cygwin-request AT cygwin DOT com?subject=help> |
| List-Subscribe: | <https://cygwin.com/mailman/listinfo/cygwin>, |
| <mailto:cygwin-request AT cygwin DOT com?subject=subscribe> | |
| From: | Max Mikhanosha via Cygwin <cygwin AT cygwin DOT com> |
| Reply-To: | Max Mikhanosha <max DOT mikhanosha AT protonmail DOT com> |
| Sender: | "Cygwin" <cygwin-bounces+archive-cygwin=delorie DOT com AT cygwin DOT com> |
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 <iostream>
#include <fstream>
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 AT MARS ~
$ g++ blah.cc
user AT MARS ~
$ ./a.exe # this does not work
Unable to open /proc/cpuinfo
user AT MARS ~
$ ./a.exe foobar # this works
user AT MARS ~
$ ldd a.exe
ntdll.dll => /cygdrive/c/WINDOWS/SYSTEM32/ntdll.dll (0x7ffa5c790000)
KERNEL32.DLL => /cygdrive/c/WINDOWS/System32/KERNEL32.DLL (0x7ffa5ab20000)
KERNELBASE.dll => /cygdrive/c/WINDOWS/System32/KERNELBASE.dll (0x7ffa5a000000)
cygwin1.dll => /usr/bin/cygwin1.dll (0x180040000)
cyggcc_s-seh-1.dll => /usr/bin/cyggcc_s-seh-1.dll (0x3e6ea0000)
cygstdc++-6.dll => /usr/bin/cygstdc++-6.dll (0x3be3a0000)
user AT MARS ~
$ cygcheck -f /usr/bin/cyggcc_s-seh-1.dll /usr/bin/cygstdc++-6.dll /usr/bin/cygwin1.dll
cygwin-3.2.0-1
libgcc1-10.2.0-1
libstdc++6-10.2.0-1
gdb shows that it crashes inside _newlib_flockfile_start(fp) as shown below
Thread 1 "a" hit Breakpoint 1, _fopen_r (ptr=0xffffd680,
file=0x10040300a <std::piecewise_construct+10> "/proc/cpuinfo", mode=0x3be4a17bb "r+")
at /usr/src/debug/cygwin-3.2.0-1/newlib/libc/stdio/fopen.c:119
119 {
(gdb) n
124 if ((flags = __sflags (ptr, mode, &oflags)) == 0)
(gdb) n
126 if ((fp = __sfp (ptr)) == NULL)
(gdb) n
129 if ((f = _open_r (ptr, file, oflags, 0666)) < 0)
(gdb) n
140 _newlib_flockfile_start (fp);
(gdb) n
0 [main] a 4876 cygwin_exception::open_stackdumpfile: Dumping stack trace to a.exe.stackdump
[Thread 8800.0x4220 exited with code 35584]
[Thread 8800.0x1100 exited with code 35584]
[Thread 8800.0x1230 exited with code 35584]
[Thread 8800.0x3cc4 exited with code 35584]
Googling around found this https://sourceware.org/pipermail/newlib/2015/012649.html which gave me idea to try opening normal file first to see if this fixes it, and it does, so likely this patch will fix this problem
--
Problem reports: https://cygwin.com/problems.html
FAQ: https://cygwin.com/faq/
Documentation: https://cygwin.com/docs.html
Unsubscribe info: https://cygwin.com/ml/#unsubscribe-simple
| webmaster | delorie software privacy |
| Copyright © 2019 by DJ Delorie | Updated Jul 2019 |