Re: vfork always fail problem

2010-05-26 Thread Corinna Vinschen
On May 20 11:43, Huang Bambo wrote:
 2010/5/20 Huang Bambo bambo.hu...@gmail.com:
  Huang,
 
  you - as the person who first saw and documented the problem in public
  (thank you!) - are in the best position to test it, if you can recreate the
  original situation (with the GBK(?) directory names).
 
  It would be beneficial to all of us, and you would be doing everybody a
  favour (if you wish, which is your choice), if you could test if the 
  problem
  reproduces with Cygwin 1.7.5, and goes away with the snapshot.
 
  fork() now work well but find new problem after use the 0518 patch.
  Usually I use mintty to as the default term tool. After use this patch, I 
  can't
  directly use mintty to open the first shell( like nothing happened), I
  must use Cygwin.bat to create
  a fist shell, then use short cut of mintty in the start menu to open others.
 
  I'll find out why if I have time.
 
 terminate while calling forkpty().

I'm using mintty with the latest from CVS and I can't reproduce this.
Mintty starts just fine from a shortcut with target
C:\cygwin\bin\mintty.exe -.


Corinna

-- 
Corinna Vinschen  Please, send mails regarding Cygwin to
Cygwin Project Co-Leader  cygwin AT cygwin DOT com
Red Hat

--
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



Re: vfork always fail problem

2010-05-26 Thread Corinna Vinschen
On May 19 00:07, Kazuhiro Fujieda wrote:
  On Tue, 18 May 2010 10:31:36 -0400
  Christopher Faylor said:
 
 2010-05-18  Kazuhiro Fujida  fuji...@acm.org
 
 I mistyped my name in ChangeLog.
 Please correct Fujida to Fujieda on the first opportunity.

Done.


Corinna

-- 
Corinna Vinschen  Please, send mails regarding Cygwin to
Cygwin Project Co-Leader  cygwin AT cygwin DOT com
Red Hat

--
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



Re: vfork always fail problem

2010-05-19 Thread Matthias Andree

Huang Bambo wrote on 2010-05-19:


 http://cygwin.com/snapshots/

To the OP: please check it out and verify that it solves your problem.



Thanks a lot. I've changed my work directory to a full English name  
directory

and it dosn't matter me.
And this problem is first reported by gcc, strange :) .


Huang,

you - as the person who first saw and documented the problem in public  
(thank you!) - are in the best position to test it, if you can recreate  
the original situation (with the GBK(?) directory names).


It would be beneficial to all of us, and you would be doing everybody a  
favour (if you wish, which is your choice), if you could test if the  
problem reproduces with Cygwin 1.7.5, and goes away with the snapshot.


Thank you.

Best

--
Matthias Andree

--
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



Re: vfork always fail problem

2010-05-19 Thread Huang Bambo
 Huang,

 you - as the person who first saw and documented the problem in public
 (thank you!) - are in the best position to test it, if you can recreate the
 original situation (with the GBK(?) directory names).

 It would be beneficial to all of us, and you would be doing everybody a
 favour (if you wish, which is your choice), if you could test if the problem
 reproduces with Cygwin 1.7.5, and goes away with the snapshot.

fork() now work well but find new problem after use the 0518 patch.
Usually I use mintty to as the default term tool. After use this patch, I can't
directly use mintty to open the first shell( like nothing happened), I
must use Cygwin.bat to create
a fist shell, then use short cut of mintty in the start menu to open others.

I'll find out why if I have time.

Thak you.

Best

--
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



Re: vfork always fail problem

2010-05-19 Thread Huang Bambo
2010/5/20 Huang Bambo bambo.hu...@gmail.com:
 Huang,

 you - as the person who first saw and documented the problem in public
 (thank you!) - are in the best position to test it, if you can recreate the
 original situation (with the GBK(?) directory names).

 It would be beneficial to all of us, and you would be doing everybody a
 favour (if you wish, which is your choice), if you could test if the problem
 reproduces with Cygwin 1.7.5, and goes away with the snapshot.

 fork() now work well but find new problem after use the 0518 patch.
 Usually I use mintty to as the default term tool. After use this patch, I 
 can't
 directly use mintty to open the first shell( like nothing happened), I
 must use Cygwin.bat to create
 a fist shell, then use short cut of mintty in the start menu to open others.

 I'll find out why if I have time.

terminate while calling forkpty().


 Thak you.

 Best


--
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



Re: vfork always fail problem

2010-05-18 Thread Kazuhiro Fujieda
 On Fri, 14 May 2010 21:22:02 +0200
 Corinna Vinschen said:

 That sounds a bit weird.  The joke of using the ...W functions is that
 the string parameters are always given in UTF-16.  GBK is a multibyte
 charset and can only be used in conjunction with the ...A functions.
 However, I'm on vacation so I can't test this scenario right now.

GetModuleFileName used in pinfo_basic::pinfo_basic disturbs the
order. This function uses ANSI codepage. 'fork' for a file whose
name contains multibyte characters doesn't work well in UTF-8 locales.

This call should be GetModuleFileNameW and the type of progname
in _pinfo should be wide characters. I attached the patch.
-- 
Kazuhiro Fujieda
fuji...@acm.org

2010-05-18  Kazuhiro Fujida  fuji...@acm.org

* environ.cc (regopt): Change the first argument to wide char string.
(environ_init): Accommodate change to the first argument of regopt.
* exception.cc (open_stackdumpfile): Accommodate change to the type
of progname in _pinfo.
* external.cc (fillout_pinfo): Ditto.
* fhandler_process.cc (format_process_winexename): Ditto.
(format_process_stat): Ditto.
* fork.cc (fork::parent): Ditto.
* pinfo.cc (pinfo_basic::pinfo_basic): Call GetModuleFileNameW
instead of GetModuleFileName.
(pinfo::thisproc): Accommodate change to the type of progname in
_pinfo.
(pinfo_init): Ditto.
* pinfo.h (_pinfo): Change the type of progname to a wide char array.
* registry.h (reg_key::get_int): Change the first argument from
constant point to pointer to constant.
(reg_key::get_string): Ditto. Change the last argument likewise.
* registry.cc (reg_key::get_int): Accommodate change to the
declaration.
(reg_key::get_string): Ditto.
* strace.cc (strace::hello): Accommodate change to the type of
progname in _pinfo.
(strace::vsprntf): Ditto.

Index: environ.cc
===
RCS file: /cvs/src/src/winsup/cygwin/environ.cc,v
retrieving revision 1.182
diff -u -r1.182 environ.cc
--- environ.cc  16 Nov 2009 20:05:49 -  1.182
+++ environ.cc  18 May 2010 05:31:45 -
@@ -29,6 +29,7 @@
 #include registry.h
 #include environ.h
 #include child_info.h
+#include ntdll.h
 
 extern bool dos_file_warning;
 extern bool ignore_case_with_glob;
@@ -698,18 +699,24 @@
 
 /* Set options from the registry. */
 static bool __stdcall
-regopt (const char *name, char *buf)
+regopt (const WCHAR *name, char *buf)
 {
   bool parsed_something = false;
-  char lname[strlen (name) + 1];
-  strlwr (strcpy (lname, name));
+  UNICODE_STRING lname;
+  size_t len = (wcslen(name) + 1) * sizeof (WCHAR);
+  RtlInitEmptyUnicodeString(lname, (PWCHAR) alloca (len), len);
+  wcscpy(lname.Buffer, name);
+  RtlDowncaseUnicodeString(lname, lname, FALSE);
 
   for (int i = 0; i  2; i++)
 {
   reg_key r (i, KEY_READ, CYGWIN_INFO_PROGRAM_OPTIONS_NAME, NULL);
 
-  if (r.get_string (lname, buf, NT_MAX_PATH, ) == ERROR_SUCCESS)
+  if (r.get_string (lname.Buffer, (PWCHAR) buf, NT_MAX_PATH, L) == 
ERROR_SUCCESS)
{
+ char *newp;
+ sys_wcstombs_alloc(newp, HEAP_NOTHEAP, (PWCHAR) buf);
+ strcpy(buf, newp);
  parse_options (buf);
  parsed_something = true;
  break;
@@ -747,7 +754,7 @@
   }
 
   char *tmpbuf = tp.t_get ();
-  got_something_from_registry = regopt (default, tmpbuf);
+  got_something_from_registry = regopt (Ldefault, tmpbuf);
   if (myself-progname[0])
 got_something_from_registry = regopt (myself-progname, tmpbuf)
  || got_something_from_registry;
Index: exceptions.cc
===
RCS file: /cvs/src/src/winsup/cygwin/exceptions.cc,v
retrieving revision 1.343
diff -u -r1.343 exceptions.cc
--- exceptions.cc   20 Apr 2010 10:44:52 -  1.343
+++ exceptions.cc   18 May 2010 05:31:45 -
@@ -130,24 +130,21 @@
 {
   if (myself-progname[0])
 {
-  const char *p;
+  const WCHAR *p;
   /* write to progname.stackdump if possible */
   if (!myself-progname[0])
-   p = unknown;
-  else if ((p = strrchr (myself-progname, '\\')))
+   p = Lunknown;
+  else if ((p = wcsrchr (myself-progname, L'\\')))
p++;
   else
p = myself-progname;
 
-  WCHAR corefile[strlen (p) + sizeof (.stackdump)];
+  WCHAR corefile[wcslen (p) + sizeof (L.stackdump)];
+  wcscpy(corefile, p);
   UNICODE_STRING ucore;
   OBJECT_ATTRIBUTES attr;
   /* Create the UNICODE variation of progname.stackdump. */
-  RtlInitEmptyUnicodeString (ucore, corefile,
-sizeof corefile - sizeof (WCHAR));
-  ucore.Length = sys_mbstowcs (ucore.Buffer,
-  ucore.MaximumLength / sizeof (WCHAR),
-  p, strlen (p)) * 

Re: vfork always fail problem

2010-05-18 Thread Christopher Faylor
On Tue, May 18, 2010 at 02:47:57PM +0900, Kazuhiro Fujieda wrote:
 On Fri, 14 May 2010 21:22:02 +0200
 Corinna Vinschen said:

 That sounds a bit weird.  The joke of using the ...W functions is that
 the string parameters are always given in UTF-16.  GBK is a multibyte
 charset and can only be used in conjunction with the ...A functions.
 However, I'm on vacation so I can't test this scenario right now.

GetModuleFileName used in pinfo_basic::pinfo_basic disturbs the
order. This function uses ANSI codepage. 'fork' for a file whose
name contains multibyte characters doesn't work well in UTF-8 locales.

This call should be GetModuleFileNameW and the type of progname
in _pinfo should be wide characters. I attached the patch.

2010-05-18  Kazuhiro Fujida  fuji...@acm.org

   * environ.cc (regopt): Change the first argument to wide char string.
   (environ_init): Accommodate change to the first argument of regopt.
   * exception.cc (open_stackdumpfile): Accommodate change to the type
   of progname in _pinfo.
   * external.cc (fillout_pinfo): Ditto.
   * fhandler_process.cc (format_process_winexename): Ditto.
   (format_process_stat): Ditto.
   * fork.cc (fork::parent): Ditto.
   * pinfo.cc (pinfo_basic::pinfo_basic): Call GetModuleFileNameW
   instead of GetModuleFileName.
   (pinfo::thisproc): Accommodate change to the type of progname in
   _pinfo.
   (pinfo_init): Ditto.
   * pinfo.h (_pinfo): Change the type of progname to a wide char array.
   * registry.h (reg_key::get_int): Change the first argument from
   constant point to pointer to constant.
   (reg_key::get_string): Ditto. Change the last argument likewise.
   * registry.cc (reg_key::get_int): Accommodate change to the
   declaration.
   (reg_key::get_string): Ditto.
   * strace.cc (strace::hello): Accommodate change to the type of
   progname in _pinfo.
   (strace::vsprntf): Ditto.

Index: environ.cc
===
RCS file: /cvs/src/src/winsup/cygwin/environ.cc,v
retrieving revision 1.182
diff -u -r1.182 environ.cc
--- environ.cc 16 Nov 2009 20:05:49 -  1.182
+++ environ.cc 18 May 2010 05:31:45 -
@@ -29,6 +29,7 @@
 #include registry.h
 #include environ.h
 #include child_info.h
+#include ntdll.h
 
 extern bool dos_file_warning;
 extern bool ignore_case_with_glob;
@@ -698,18 +699,24 @@
 
 /* Set options from the registry. */
 static bool __stdcall
-regopt (const char *name, char *buf)
+regopt (const WCHAR *name, char *buf)
 {
   bool parsed_something = false;
-  char lname[strlen (name) + 1];
-  strlwr (strcpy (lname, name));
+  UNICODE_STRING lname;
+  size_t len = (wcslen(name) + 1) * sizeof (WCHAR);
+  RtlInitEmptyUnicodeString(lname, (PWCHAR) alloca (len), len);
+  wcscpy(lname.Buffer, name);
+  RtlDowncaseUnicodeString(lname, lname, FALSE);
 
   for (int i = 0; i  2; i++)
 {
   reg_key r (i, KEY_READ, CYGWIN_INFO_PROGRAM_OPTIONS_NAME, NULL);
 
-  if (r.get_string (lname, buf, NT_MAX_PATH, ) == ERROR_SUCCESS)
+  if (r.get_string (lname.Buffer, (PWCHAR) buf, NT_MAX_PATH, L) == 
ERROR_SUCCESS)
   {
+char *newp;
+sys_wcstombs_alloc(newp, HEAP_NOTHEAP, (PWCHAR) buf);
+strcpy(buf, newp);
 parse_options (buf);
 parsed_something = true;
 break;
@@ -747,7 +754,7 @@
   }
 
   char *tmpbuf = tp.t_get ();
-  got_something_from_registry = regopt (default, tmpbuf);
+  got_something_from_registry = regopt (Ldefault, tmpbuf);
   if (myself-progname[0])
 got_something_from_registry = regopt (myself-progname, tmpbuf)
 || got_something_from_registry;
Index: exceptions.cc
===
RCS file: /cvs/src/src/winsup/cygwin/exceptions.cc,v
retrieving revision 1.343
diff -u -r1.343 exceptions.cc
--- exceptions.cc  20 Apr 2010 10:44:52 -  1.343
+++ exceptions.cc  18 May 2010 05:31:45 -
@@ -130,24 +130,21 @@
 {
   if (myself-progname[0])
 {
-  const char *p;
+  const WCHAR *p;
   /* write to progname.stackdump if possible */
   if (!myself-progname[0])
-  p = unknown;
-  else if ((p = strrchr (myself-progname, '\\')))
+  p = Lunknown;
+  else if ((p = wcsrchr (myself-progname, L'\\')))
   p++;
   else
   p = myself-progname;
 
-  WCHAR corefile[strlen (p) + sizeof (.stackdump)];
+  WCHAR corefile[wcslen (p) + sizeof (L.stackdump)];
^^
No L is needed here, AFAICT.

I've checked this in, removing the L.

Thanks for the patch.

Appreciated.

Next time maybe you could send this to cygwin-patches?

cgf

--
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



Re: vfork always fail problem

2010-05-18 Thread Eric Blake
On 05/18/2010 08:31 AM, Christopher Faylor wrote:

 -  WCHAR corefile[strlen (p) + sizeof (.stackdump)];
 +  WCHAR corefile[wcslen (p) + sizeof (L.stackdump)];
 ^^
 No L is needed here, AFAICT.

 I've checked this in, removing the L.

I had to think about that, so I'm replying to document my thoughts.  You
want either 'sizeof (.stackdump)' or 'sizeof (L.stackdump) / sizeof
WCHAR'; and since both give the same value, Chris' change is correct.

-- 
Eric Blake   ebl...@redhat.com+1-801-349-2682
Libvirt virtualization library http://libvirt.org



signature.asc
Description: OpenPGP digital signature


Re: vfork always fail problem

2010-05-18 Thread Kazuhiro Fujieda
 On Tue, 18 May 2010 10:31:36 -0400
 Christopher Faylor said:

2010-05-18  Kazuhiro Fujida  fuji...@acm.org

I mistyped my name in ChangeLog.
Please correct Fujida to Fujieda on the first opportunity.

-  WCHAR corefile[strlen (p) + sizeof (.stackdump)];
+  WCHAR corefile[wcslen (p) + sizeof (L.stackdump)];
 ^^
 No L is needed here, AFAICT.

You are right.

 I've checked this in, removing the L.

Thank you.

 Next time maybe you could send this to cygwin-patches?

Yes, I will do so.
-- 
Kazuhiro Fujieda
fuji...@acm.org

--
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



Re: vfork always fail problem

2010-05-18 Thread Christopher Faylor
On Tue, May 18, 2010 at 08:45:26AM -0600, Eric Blake wrote:
On 05/18/2010 08:31 AM, Christopher Faylor wrote:

 -  WCHAR corefile[strlen (p) + sizeof (.stackdump)];
 +  WCHAR corefile[wcslen (p) + sizeof (L.stackdump)];
 ^^
 No L is needed here, AFAICT.

 I've checked this in, removing the L.

I had to think about that, so I'm replying to document my thoughts.  You
want either 'sizeof (.stackdump)' or 'sizeof (L.stackdump) / sizeof
WCHAR'; and since both give the same value, Chris' change is correct.

Lately, I've been partial to (strlen (.stackdump) + 1) since that
usually translates to a constant.  I didn't do that in this case since
the original code didn't do it.

Of course, the L doesn't hurt anything, regardless.

Btw, there is now a snapshot with this change:

  http://cygwin.com/snapshots/

To the OP: please check it out and verify that it solves your problem.

cgf

--
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



Re: vfork always fail problem

2010-05-18 Thread Huang Bambo
  http://cygwin.com/snapshots/

 To the OP: please check it out and verify that it solves your problem.


Thanks a lot. I've changed my work directory to a full English name directory
and it dosn't matter me.
And this problem is first reported by gcc, strange :) .

 cgf

 --
 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



--
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



Re: vfork always fail problem

2010-05-14 Thread Matthias Andree

Am 14.05.2010, 06:29 Uhr, schrieb Huang Bambo:


[ba...@bambo-notebook 4.4.4]$ cat tvfork.c
#include sys/types.h
#include unistd.h
#include stdio.h

int main(void)
{
pid_t pid = vfork();
if ( pid  0 )
{
printf(I'm chield.\n);
_exit(0);
}
else if ( pid == 0 )
{
printf(I'm parent);
}


You've got these swapped. pid == 0 means child,  0 means parent (so that  
it directly has the PID of its child and can later call waitpid()).


You later wrote you've issues with the path; does the same happen if you  
use fork rather than vfork?  vfork()ed child processes must not do  
anything but modify a variable of type pid_t, call _exit() or exec*().


--
Matthias Andree

--
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



Re: vfork always fail problem

2010-05-14 Thread Huang Bambo
I's the problem of the fork() pass a wrong program path to CreateProcessW.

It shoud pass a GBK code pathname to CreateProcessW but if I set
 LANG=en_US.UTF-8, the pathname passed to CreateProcessW is UTF-8, so
CreateProcessW report file not found.


2010/5/14 Matthias Andree matthias.and...@gmx.de:
 Am 14.05.2010, 06:29 Uhr, schrieb Huang Bambo:

 [ba...@bambo-notebook 4.4.4]$ cat tvfork.c
 #include sys/types.h
 #include unistd.h
 #include stdio.h

 int main(void)
 {
        pid_t pid = vfork();
        if ( pid  0 )
        {
                printf(I'm chield.\n);
                _exit(0);
        }
        else if ( pid == 0 )
        {
                printf(I'm parent);
        }

 You've got these swapped. pid == 0 means child,  0 means parent (so that it
 directly has the PID of its child and can later call waitpid()).

 You later wrote you've issues with the path; does the same happen if you use
 fork rather than vfork?  vfork()ed child processes must not do anything
 but modify a variable of type pid_t, call _exit() or exec*().

 --
 Matthias Andree

 --
 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



--
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



Re: vfork always fail problem

2010-05-14 Thread Corinna Vinschen
On May 14 16:54, Huang Bambo wrote:
 I's the problem of the fork() pass a wrong program path to CreateProcessW.
 
 It shoud pass a GBK code pathname to CreateProcessW but if I set
  LANG=en_US.UTF-8, the pathname passed to CreateProcessW is UTF-8, so
 CreateProcessW report file not found.

That sounds a bit weird.  The joke of using the ...W functions is that
the string parameters are always given in UTF-16.  GBK is a multibyte
charset and can only be used in conjunction with the ...A functions.
However, I'm on vacation so I can't test this scenario right now.


Corinna

-- 
Corinna Vinschen  Please, send mails regarding Cygwin to
Cygwin Project Co-Leader  cygwin AT cygwin DOT com
Red Hat

--
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



vfork always fail problem

2010-05-13 Thread Huang Bambo
[ba...@bambo-notebook 4.4.4]$ cat tvfork.c
#include sys/types.h
#include unistd.h
#include stdio.h

int main(void)
{
pid_t pid = vfork();
if ( pid  0 )
{
printf(I'm chield.\n);
_exit(0);
}
else if ( pid == 0 )
{
printf(I'm parent);
}
else
{
perror(vfork failed.);
}
}
[ba...@bambo-notebook 4.4.4]$ make tvfork
cc tvfork.c   -o tvfork
[ba...@bambo-notebook 4.4.4]$ ./tvfork.exe
  4 [main] tvfork 4136 fork: child -1 - CreateProcessW failed, errno 2
vfork failed.: No such file or directory
[ba...@bambo-notebook 4.4.4]$ ./tvfork
  3 [main] tvfork 2956 fork: child -1 - CreateProcessW failed, errno 2
vfork failed.: No such file or directory

I think maybe the wrong parameters were sent while calling CreateProcessW.

--
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



Re: vfork always fail problem

2010-05-13 Thread Huang Bambo
Finally I test and get another result.
I run the test program at
/home/Bambo/test/t1/
but /home/Bambo/test is a symbolic link to another directory.
Maybe it's the problem that the system handle symbolic

2010/5/14 Huang Bambo bambo.hu...@gmail.com:
 [ba...@bambo-notebook 4.4.4]$ cat tvfork.c
 #include sys/types.h
 #include unistd.h
 #include stdio.h

 int main(void)
 {
        pid_t pid = vfork();
        if ( pid  0 )
        {
                printf(I'm chield.\n);
                _exit(0);
        }
        else if ( pid == 0 )
        {
                printf(I'm parent);
        }
        else
        {
                perror(vfork failed.);
        }
 }
 [ba...@bambo-notebook 4.4.4]$ make tvfork
 cc     tvfork.c   -o tvfork
 [ba...@bambo-notebook 4.4.4]$ ./tvfork.exe
      4 [main] tvfork 4136 fork: child -1 - CreateProcessW failed, errno 2
 vfork failed.: No such file or directory
 [ba...@bambo-notebook 4.4.4]$ ./tvfork
      3 [main] tvfork 2956 fork: child -1 - CreateProcessW failed, errno 2
 vfork failed.: No such file or directory

 I think maybe the wrong parameters were sent while calling CreateProcessW.


--
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



Re: vfork always fail problem

2010-05-13 Thread Huang Bambo
I truly find the problem.
The path to the executable have Chinese character.
My windows's default language is gbk.
If I use utf-8 encoding for the shell, fork fail. If i use gbk, everything
goes fine.
The following is the test .

[ba...@bambo-notebook ARM9]$ pwd
/cygdrive/d/个人研发/ARM9
  ^^ Chinese directory name

[ba...@bambo-notebook ARM9]$ export LANG=en_US.UTF-8
[ba...@bambo-notebook ARM9]$ ./tvfork.exe
  3 [main] tvfork 4900 fork: child -1 - CreateProcessW failed, errno 2
vfork failed.: No such file or directory
[ba...@bambo-notebook ARM9]$ export LANG=en_US.GBK
[ba...@bambo-notebook ARM9]$ ./tvfork.exe
I'm parentI'm chield.


2010/5/14 Huang Bambo bambo.hu...@gmail.com:
 Finally I test and get another result.
 I run the test program at
 /home/Bambo/test/t1/
 but /home/Bambo/test is a symbolic link to another directory.
 Maybe it's the problem that the system handle symbolic

 2010/5/14 Huang Bambo bambo.hu...@gmail.com:
 [ba...@bambo-notebook 4.4.4]$ cat tvfork.c
 #include sys/types.h
 #include unistd.h
 #include stdio.h

 int main(void)
 {
pid_t pid = vfork();
if ( pid  0 )
{
printf(I'm chield.\n);
_exit(0);
}
else if ( pid == 0 )
{
printf(I'm parent);
}
else
{
perror(vfork failed.);
}
 }
 [ba...@bambo-notebook 4.4.4]$ make tvfork
 cc tvfork.c   -o tvfork
 [ba...@bambo-notebook 4.4.4]$ ./tvfork.exe
  4 [main] tvfork 4136 fork: child -1 - CreateProcessW failed, errno 2
 vfork failed.: No such file or directory
 [ba...@bambo-notebook 4.4.4]$ ./tvfork
  3 [main] tvfork 2956 fork: child -1 - CreateProcessW failed, errno 2
 vfork failed.: No such file or directory

 I think maybe the wrong parameters were sent while calling CreateProcessW.



--
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



Re: vfork always fail problem

2010-05-13 Thread Václav Haisman
Huang Bambo wrote, On 14.5.2010 6:29:
 [ba...@bambo-notebook 4.4.4]$ cat tvfork.c
 #include sys/types.h
 #include unistd.h
 #include stdio.h
 
 int main(void)
 {
 pid_t pid = vfork();
 if ( pid  0 )
 {
 printf(I'm chield.\n);
 _exit(0);
 }
 else if ( pid == 0 )
 {
 printf(I'm parent);
 }
 else
 {
 perror(vfork failed.);
 }
 }
 [ba...@bambo-notebook 4.4.4]$ make tvfork
 cc tvfork.c   -o tvfork
 [ba...@bambo-notebook 4.4.4]$ ./tvfork.exe
   4 [main] tvfork 4136 fork: child -1 - CreateProcessW failed, errno 2
 vfork failed.: No such file or directory
 [ba...@bambo-notebook 4.4.4]$ ./tvfork
   3 [main] tvfork 2956 fork: child -1 - CreateProcessW failed, errno 2
 vfork failed.: No such file or directory
 
 I think maybe the wrong parameters were sent while calling CreateProcessW.
 
 --
 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
 

--
VH

--
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