This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Cygwin 1.5.11: execv doesn't set argv[0] on Windows programs


Hi,

I'm getting the following behavior consistently:

$ bash -c 'exec -a KKKK java -h' 2>&1 | egrep 'options?]'
Usage: java.exe [-options] class [args...]
   or  java.exe [-jar] [-options] jarfile [args...]
$

but

$ bash -c 'exec -a KKKK bash --help' 2>&1 | egrep 'options?]'
Usage:  KKKK [GNU long option] [option] ...
        KKKK [GNU long option] [option] script-file ...
$

In other words, invoking a Cygwin program sets argv[0] correctly, but
invoking a Windows program doesn't.  Interestingly enough, using the MinGW
execv works properly:

$ cat ex.c
#include <stdlib.h>
int main(int ac, char *av[]) {
  char const *args[] = { "KKKK", "-h", NULL };
  return execv("c:/Program Files/IBM/Java14/bin/java", args);
}
$ make -W ex.c CC="gcc -mno-cygwin" ex
gcc -mno-cygwin     ex.c   -o ex
$ ./ex 2>&1 | egrep 'options?]'
Usage: KKKK [-options] class [args...]
   or  KKKK [-jar] [-options] jarfile [args...]
$ make -W ex.c ex
gcc     ex.c   -o ex
$ ./ex 2>&1 | egrep 'options?]'
Usage: java.exe [-options] class [args...]
   or  java.exe [-jar] [-options] jarfile [args...]
$ uname -a
CYGWIN_NT-5.1 pechtcha 1.5.12(0.116/4/2) 2004-09-07 15:07 i686 unknown unknown Cygwin

(yes, a self-built DLL from CVS, but the same problem occurs with 1.5.10).

I have a nagging suspicion that the culprit is somewhere in spawn_guts(),
and will poke some more at it unless someone knows off-hand where the
problem is.
	Igor
-- 
				http://cs.nyu.edu/~pechtcha/
      |\      _,,,---,,_		pechtcha@cs.nyu.edu
ZZZzz /,`.-'`'    -.  ;-;;,_		igor@watson.ibm.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
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]