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]

Re: Problem with latest setup-x86.exe


Corinna Vinschen wrote:
>I just explained that in a reply an the cygwin-apps list:
>http://cygwin.com/ml/cygwin-apps/2013-11/msg00075.html>
>
>I applied a patch to setup which should fix the issue.
>

I grabbed the latest source (which has the nt_fopen in it)
and built it without the argv patch, but it still has the same
problem. __argv is always zero.

So, I tried the following under cygwin's mingw32:



#include <stdio.h>
#include <stdlib.h>

/* extern char *** __p___argv(void); */


#if 1
#define argc _argc
#define argv _argv
#endif

#if 0
#define argc __argc
#define argv __argv
#endif

int main(int argc, char **argv, char **envp)
{
register int i;

printf ("_argc = 0x%x\n", _argc);
printf ("__argc = 0x%x\n", __argc);
printf ("__p___argc() = 0x%x\n", __p___argc());
printf ("*(__p___argc()) = 0x%x\n", *(__p___argc()));
printf ("\n");
printf ("_argv = 0x%x\n", _argv);
printf ("__argv = 0x%x\n", __argv);
printf ("__p___argv() = 0x%x\n", __p___argv());
printf ("*(__p___argv()) = 0x%x\n", *(__p___argv()));
printf ("\n");

printf("argc=%d\n", argc);
for (i=0; i<argc; i++)
printf("argv[%d]=%s\n", i, argv[i]);
return(0);
}

and then I ran it on my machine and four other windows 7 pro machines
using "tst abc def" and get:


_argc = 0x3
__argc = 0x0
__p___argc() = 0x755830e4
*(__p___argc()) = 0x0

_argv = 0x5b1680
__argv = 0x0
__p___argv() = 0x755830c0
*(__p___argv()) = 0x0

argc=3
argv[0]=C:\cygwin\usr\local\src\cygwin_setup\tst\tst.exe
argv[1]=abc
argv[2]=def

on all these machines.

I don't know how that for loop on __argv in main.cc can work with __argv
always returning zero, but admittedly setup.exe does work
on some of these machines without my changes, just not on others.
My changes produce a setup that does work on all of them.
I have to admit I haven't been able to figure out what __argv really
does since it always returns zero on any machine I try.  So, I'm still
puzzled.





--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple


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