This is the mail archive of the
mailing list for the Cygwin project.
Re: seg-vios from gcc program at execv() on Windows XP
- From: Igor Pechtchanski <pechtcha at cs dot nyu dot edu>
- To: Richard Troy <rtroy at ScienceTools dot com>
- Cc: cygwin at cygwin dot com
- Date: Thu, 30 Sep 2004 11:28:56 -0400 (EDT)
- Subject: Re: seg-vios from gcc program at execv() on Windows XP
- References: <Pine.LNX.email@example.com>
- Reply-to: cygwin at cygwin dot com
On Thu, 30 Sep 2004, Richard Troy wrote:
> Hello Cygwiners,
I believe the technical term is "cygwinners" (unless you really mean
> I'm a long-time user of Cygwin - love it, depend on it... and rarely have
> a problem, but I really need some help with this one particular problem.
> I've already tapped into my other technical resources on this and haven't
> gotten anywhere at all. It isn't clear this is a Cygwin problem, but then,
> it isn't clear that it isn't, either. ...I really need some insight
> A couple of weeks ago some skum-bag stole my laptop and my new one came
> with Windows XP Professional. ...I now understand what XP stands for: XP
> means eXtremely Painful. Anyway, I use the laptop for sales calls (I'm the
> technical person) and it just _has_ to work. I've been having trouble
> getting my company's software working on the system and my boss said,
> "well, this is a good chance for you to make sure our stuff works on XP,
> so, have fun!" - or words to that effect... But I am _not_ having fun.
> The problem is that we've got a GCC based program that ends up calling
> Java via execv(). It _always_ seg-vios when the GCC program itself
> is called from another program (non-interactive) and it sometimes seg-vios
> when run from an interactive Cygwin Bash prompt. Significant testing has
> shown that the interactive failure seems to be associated with environment
> variables. For example, the code uses an environment variable to determine
> if it should output "verbose" statements to std-out (via printf), and if
> this is set, the execv() always fails. However, it also fails sometimes
> depending on other variables that should have _nothing_ to do with the
> Here's an excerpt of the code in the vicinity of the exec:
> // make sure that argv0 is fully qualified so that java doesn't
> // default to a local binary
> //nargv= "java";
> nargv= "-classpath";
> nargv= classpathenv;
> nargv= std;
> nargv= ck;
> nargv= rus;
> nargv= host;
> nargv= stc;
> nargv= stt;
> nargv= dk;
> nargv= cl;
> i = execv(program, nargv);
> Note that the code is _rock_solid_ on Linux/Unix/Mac OSX, and on all
> earlier versions of Windows we've ever tried it on. We've _never_ seen it
> seg-vio before.
Please provide a complete (hopefully simple) testcase, along with the
compilation flags, etc. In particular, it'd be interesting to see how
nargv is allocated, etc. I suspect you're not placing a NULL at the end
of the argument list, and Cygwin and Linux allocate nargv differently (so
that on Linux, nargv just happens to have zeroed memory after it).
FWIW, I have written a program that invokes java with various arguments
via execv (in almost exactly the same way as above), and it works just
fine on XP Pro.
> Also note that I recompiled the executable on the target system. I'm
> wondering if there's something about the new installation of Cygwin on XP
> that's changed something about how the binary runs...
More likely the memory alloc changes exposed a bug in your code. If you
can come up with a program that tries invoking Java with constant
arguments and gets a SEGV, please post it.
> In case it helps: cygcheck -s says we're running 1.5.10, and gcc is
> 3.3.1-3. It was a fresh, absolutely complete installation - even the stuff
> I never need.
A better way to inform us about your system configuration would be to
*attach* (as an uncompressed text attachment) the output of "cygcheck
-svr", as requested in the Cygwin problem reporting guidelines at
> (BTW ping and dig utilities would be nice!)
FWIW, XP (and 2k) come with "`cygpath -S`/ping.exe" and
"`cygpath -S`/nslookup.exe". There were also some threads on porting ping
to Cygwin -- search the list archives.
|\ _,,,---,,_ firstname.lastname@example.org
ZZZzz /,`.-'`' -. ;-;;,_ email@example.com
|,4- ) )-,_. ,\ ( `'-' Igor Pechtchanski, Ph.D.
'---''(_/--' `-'\_) fL a.k.a JaguaR-R-R-r-r-r-.-.-. Meow!
"Happiness lies in being privileged to work hard for long hours in doing
whatever you think is worth doing." -- Dr. Jubal Harshaw
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Problem reports: http://cygwin.com/problems.html