Subject: RE: cygwin.dll bug
From: [email-masked] (Colin Peters)

29 Jan 1997 20:25:57 -0800
Approved: [email-masked]
Distribution: cygnus
Message-ID: <01BC0EA4.5031D600.cygnus.gnu-win32@gbird0>
Mime-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Original-To: "'p.a.c.tavares'" <[email-masked]>
Original-Cc: "'GNU-Win32'" <[email-masked]>
Original-Sender: [email-masked]

p.a.c.tavares[SMTP:[email-masked]] wrote:
>I found two problems when using functions from string.h (the C one, not
>String.h) in win95. I believe they are caused by bugs in the utilities and
>not by my own mistakes. 
>
>1. when using GNU make to create the code the compiler confuses string.h
>and String.h. Because by default String.h comes first on the include path,
>cpp will include the GNU-C++ String.h when it should include C string.h

This is a known problem (as far as I know :-/ ) which seems like it will a
little tricky for the Cygnus people to resolve. Since the OS supplied file
I/O functions are not case sensitive they would have to, I suppose, check
that the case of the program supplied file name matched the case of the
file opened by the OS and fail if they didn't match. This still wouldn't
fix really bad ones like having makefile and Makefile in the same directory.

>2. Once this problem was solved by renaming String.h I found that it
>compiled and linked with no problems. However I get a runtime error
>concerning the function strncpy( ). Under gdb I get the following report: 
>
>Program received signal SIGSEGV, Segmentation fault.
>strncpy (dst=0x263eb30 "H_c\002\027&@", src=0x0, n=20)
>    at /pizza/mushroom/noer/beta17/src/newlib/libc/string/strncpy.c:58
>/pizza/mushroom/noer/beta17/src/newlib/libc/string/strncpy.c:58: No such file or
> directory.
>Current language:  auto; currently c

The debugger appears to be telling you that you called strncpy with a null
src pointer (src=0x0), which would indeed cause a segmentation fault. If
your code is not at fault then something truly bizarre is happening to make
the src pointer zero before it gets to the strncpy function. I have to
admit I suspect the calling code (i.e. your code), not the library... sorry.

Good luck,
Colin.

-- Colin Peters - [email-masked]
-- Saga University Dept. of Information Science
-- Fundamentals of Information Science
-- http://www.fu.is.saga-u.ac.jp/~colin/home.html

-
For help on using this list, send a message to
"[email-masked]" with one line of text: "help".