Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm 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 Date: Fri, 10 Sep 2004 00:38:31 -0400 (EDT) From: Igor Pechtchanski Reply-To: cygwin AT cygwin DOT com To: cygwin AT cygwin DOT com Subject: Cygwin 1.5.11: execv doesn't set argv[0] on Windows programs Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Scanned-By: MIMEDefang 2.39 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 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 AT cs DOT nyu DOT edu ZZZzz /,`.-'`' -. ;-;;,_ igor AT watson DOT ibm DOT 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/