Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCorinna Vinschen <corinna@vinschen.de>2009-05-09 19:56:37 +0400
committerCorinna Vinschen <corinna@vinschen.de>2009-05-09 19:56:37 +0400
commit9b98d6a8fbfcb2b9b9d4b9ebd452c100055258d2 (patch)
tree88acb521e7c37c6c7108602045c0ec49c49a65aa /winsup/cygwin/dtable.cc
parenta22af4a956ce1926fb69c8f522ecf3111ee372f4 (diff)
* dtable.cc (dtable::init_std_file_from_handle): Add workaround for
Windows 7 64 bit issue. Add lengthy comment to explain what happens. * wincap.h (wincaps::has_console_handle_problem): New element. * wincap.cc: Implement above element throughout. (wincap_7): New wincaps structure for NT 6.1 kernels. (wincapc::init): Set has_console_handle_problem to false for 32 bit systems. Fix broken older ChangeLog entry.
Diffstat (limited to 'winsup/cygwin/dtable.cc')
-rw-r--r--winsup/cygwin/dtable.cc27
1 files changed, 26 insertions, 1 deletions
diff --git a/winsup/cygwin/dtable.cc b/winsup/cygwin/dtable.cc
index 30f78e1ae..641fd54ba 100644
--- a/winsup/cygwin/dtable.cc
+++ b/winsup/cygwin/dtable.cc
@@ -358,7 +358,32 @@ dtable::init_std_file_from_handle (int fd, HANDLE handle)
else
access |= GENERIC_WRITE; /* Should be rdwr for stderr but not sure that's
possible for some versions of handles */
- fh->init (handle, access, bin);
+ /* FIXME: Workaround Windows 7 64 bit issue. If the parent process of
+ the process tree closes the original handles to the console window,
+ strange problems occur when starting child processes later on if
+ stdio redirection is used. How to reproduce:
+
+ shell script foo:
+
+ exec 2>foo.log
+ FOO=$( uname -n | cat )
+ echo $FOO
+
+ start from cmd with `bash foo'. The result is that the cat process
+ will be started but dies before Cygwin strace output can be generated
+ and $FOO stays empty. The strace output shows that bash tries
+ multiple times to start cat, but none of the invocations of cat will
+ ever show up in the strace output.
+
+ Remove the `exec 2>' or remove the cat call and the script will work.
+ Start bash interactively, then start the script manually, and the
+ script will work.
+
+ This needs further investigation but the workaround not to close
+ the handles will have a marginal hit of three extra handles per
+ process at most. */
+ fh->init (dev == FH_CONSOLE && wincap.has_console_handle_problem ()
+ ? INVALID_HANDLE_VALUE : handle, access, bin);
set_std_handle (fd);
paranoid_printf ("fd %d, handle %p", fd, handle);
}