On Thu, 30 Sep 2004, Richard Troy wrote: > Hello Cygwiners,
I believe the technical term is "cygwinners" (unless you really mean "cygwhiners"? ];->) > 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 > here... > > 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. > -frown- > > 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 > program. > > Here's an excerpt of the code in the vicinity of the exec: > > strcpy(program,JavaHomeenv); > strcat(program,"/bin/java"); > // make sure that argv0 is fully qualified so that java doesn't > // default to a local binary > nargv[0]=program; > //nargv[0]= "java"; > nargv[1]= "-classpath"; > nargv[2]= classpathenv; > nargv[3]= std; > nargv[4]= ck; > nargv[5]= rus; > nargv[6]= host; > nargv[7]= stc; > nargv[8]= stt; > nargv[9]= dk; > nargv[10]= 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 <http://cygwin.com/problems.html>. > (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. Igor -- http://cs.nyu.edu/~pechtcha/ |\ _,,,---,,_ [EMAIL PROTECTED] ZZZzz /,`.-'`' -. ;-;;,_ [EMAIL PROTECTED] |,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 Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/