X-Recipient: archive-cygwin AT delorie DOT com X-SWARE-Spam-Status: No, hits=-2.4 required=5.0 tests=AWL,BAYES_00,SPF_PASS,WEIRD_PORT X-Spam-Check-By: sourceware.org Message-ID: <49FF07C4.5080200@gmail.com> Date: Mon, 04 May 2009 16:20:36 +0100 From: Dave Korn User-Agent: Thunderbird 2.0.0.17 (Windows/20080914) MIME-Version: 1.0 To: cygwin AT cygwin DOT com Subject: Re: [1.7] Weird error "grep: writing output: Cannot allocate memory" References: <49FB714A DOT 4010002 AT gmail DOT com> <20090504033921 DOT GA6162 AT ednor DOT casa DOT cgf DOT cx> In-Reply-To: <20090504033921.GA6162@ednor.casa.cgf.cx> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com Christopher Faylor wrote: >> The attached STC reproduces the problem, and apparently: >> >> gcc-3 -mno-cygwin stc.c -o stc -W -Wall -g -O0 -o stc-mingw.exe >> >> gcc-4 stc.c -o stc -W -Wall -g -O0 >> >> .. it is cygwin independent, since both executables produce similar results: > > A test case which demonstrates a failing Windows call fail isn't really > interesting as far as Cygwin is concerned. Do you have a stc which > fails using Cygwin's API? For completeness' sake, here is a testcase at the cygwin api level; note the lack of any output and the ENOMEM return. admin AT ubik /tmp/console $ gcc-4 stc-cyg.c -Wall -W -Wextra stc-cyg.c:20: warning: unused parameter 'argc' stc-cyg.c:20: warning: unused parameter 'argv' admin AT ubik /tmp/console $ ./a.exe Len is 29462 error B1 12 -1 error B2 12 1 Actual: 29446 admin AT ubik /tmp/console $ The earlier testcase I posted based on the win32 api was reduced from what eventually takes place inside fhandler_console::write_normal(): (gdb) Breakpoint 11, fhandler_console::write_normal (this=0x6122c42c, src=0x6ab898 " 411 ./libtool --tag=CXX --mode=link /gnu/gcc/obj4/./gcc/xgcc -shared-libgcc -B/gnu/gcc/obj4/./gcc -nostdinc++ -L/gnu/gcc/obj4/i686-pc-cygwin/libstdc++-v3/src -L/gnu/gcc/obj4/i686-pc-cygwin/libstdc+"..., end=0x6b2b9e "") at /gnu/winsup/src/winsup/cygwin/fhandler_console.cc:1549 1549 if (!WriteConsoleW (get_output_handle (), buf, buf_len, &done, 0)) (gdb) print buf $15 = (PWCHAR) 0x6680a8 (gdb) print buf_len $16 = (gdb) bt #0 fhandler_console::write_normal (this=0x6122c42c, src=0x6ab898 " 411 ./libtool --tag=CXX --mode=link /gnu/gcc/obj4/./gcc/xgcc -shared-libgcc -B/gnu/gcc/obj4/./gcc -nostdinc++ -L/gnu/gcc/obj4/i686-pc-cygwin/libstdc++-v3/src -L/gnu/gcc/obj4/i686-pc-cygwin/libstdc+"..., end=0x6b2b9e "") at /gnu/winsup/src/winsup/cygwin/fhandler_console.cc:1549 #1 0x610331e8 in fhandler_console::write (this=0x6122c42c, vsrc=0x6ab898, len=29446) at /gnu/winsup/src/winsup/cygwin/fhandler_console.cc:1653 #2 0x610cb4f9 in writev (fd=1, iov=0x22c9e4, iovcnt=1) at /gnu/winsup/src/winsup/cygwin/syscalls.cc:926 #3 0x610cb61f in write (fd=1, ptr=0x6ab898, len=29446) at /gnu/winsup/src/winsup/cygwin/syscalls.cc:805 #4 0x61139b89 in _write_r (ptr=0x22d008, fd=1, buf=0x6ab898, cnt=29446) at /gnu/winsup/src/newlib/libc/reent/writer.c:58 #5 0x611074f4 in _fflush_r (ptr=0x22d008, fp=0x61146780) at /gnu/winsup/src/newlib/libc/stdio/fflush.c:200 #6 0x61124fcc in __sfvwrite_r (ptr=0x22d008, fp=0x61146780, uio=0x22ca98) at /gnu/winsup/src/newlib/libc/stdio/fvwrite.c:257 #7 0x61107e9a in _fwrite_r (ptr=0x22d008, buf=0x6944e4, size=1, count=29446, fp=0x61146780) at /gnu/winsup/src/newlib/libc/stdio/fwrite.c:124 #8 0x61107f55 in fwrite (buf=0x6944e4, size=1, count=29446, fp=0x61146780) at /gnu/winsup/src/newlib/libc/stdio/fwrite.c:141 #9 0x610b2148 in _sigfe () from /usr/bin/cygwin1.dll I'll get on with trying a freshly built DLL now. cheers, DaveK -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/