summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCorinna Vinschen <corinna@vinschen.de>2009-05-09 15:56:37 +0000
committerCorinna Vinschen <corinna@vinschen.de>2009-05-09 15:56:37 +0000
commit9b98d6a8fbfcb2b9b9d4b9ebd452c100055258d2 (patch)
tree88acb521e7c37c6c7108602045c0ec49c49a65aa
parenta22af4a956ce1926fb69c8f522ecf3111ee372f4 (diff)
downloadcygnal-9b98d6a8fbfcb2b9b9d4b9ebd452c100055258d2.tar.gz
cygnal-9b98d6a8fbfcb2b9b9d4b9ebd452c100055258d2.tar.bz2
cygnal-9b98d6a8fbfcb2b9b9d4b9ebd452c100055258d2.zip
* 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.
-rw-r--r--winsup/cygwin/ChangeLog12
-rw-r--r--winsup/cygwin/dtable.cc27
-rw-r--r--winsup/cygwin/wincap.cc58
-rw-r--r--winsup/cygwin/wincap.h2
4 files changed, 96 insertions, 3 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog
index c48073f63..df415cfa7 100644
--- a/winsup/cygwin/ChangeLog
+++ b/winsup/cygwin/ChangeLog
@@ -1,5 +1,15 @@
2009-05-09 Corinna Vinschen <corinna@vinschen.de>
+ * 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.
+
+2009-05-09 Corinna Vinschen <corinna@vinschen.de>
+
* sec_auth.cc (str2uni_cat): Move from here...
* path.cc (str2uni_cat): ...to here. Simplify. Make static inline.
(get_nt_native_path): Use RtlAppendUnicodeToString rather than
@@ -880,7 +890,7 @@
* path.cc (symlink_info::check): Add workaround for UDF bug in
terms of casesensitivity on certain OSes.
* wincap.h (wincaps::has_broken_udf): New element.
- (wincaps::has_broken_udf): New element
+ * wincap.cc: Implement above element throughout.
2009-01-27 Christopher Faylor <me+cygwin@cgf.cx>
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);
}
diff --git a/winsup/cygwin/wincap.cc b/winsup/cygwin/wincap.cc
index 082343a40..14f5d4121 100644
--- a/winsup/cygwin/wincap.cc
+++ b/winsup/cygwin/wincap.cc
@@ -54,6 +54,7 @@ wincaps wincap_unknown __attribute__((section (".cygwin_dll_common"), shared)) =
has_recvmsg:false,
has_sendmsg:false,
has_broken_udf:false,
+ has_console_handle_problem:false,
};
wincaps wincap_nt4 __attribute__((section (".cygwin_dll_common"), shared)) = {
@@ -90,6 +91,7 @@ wincaps wincap_nt4 __attribute__((section (".cygwin_dll_common"), shared)) = {
has_recvmsg:false,
has_sendmsg:false,
has_broken_udf:false,
+ has_console_handle_problem:false,
};
wincaps wincap_nt4sp4 __attribute__((section (".cygwin_dll_common"), shared)) = {
@@ -126,6 +128,7 @@ wincaps wincap_nt4sp4 __attribute__((section (".cygwin_dll_common"), shared)) =
has_recvmsg:false,
has_sendmsg:false,
has_broken_udf:false,
+ has_console_handle_problem:false,
};
wincaps wincap_2000 __attribute__((section (".cygwin_dll_common"), shared)) = {
@@ -162,6 +165,7 @@ wincaps wincap_2000 __attribute__((section (".cygwin_dll_common"), shared)) = {
has_recvmsg:false,
has_sendmsg:false,
has_broken_udf:true,
+ has_console_handle_problem:false,
};
wincaps wincap_2000sp4 __attribute__((section (".cygwin_dll_common"), shared)) = {
@@ -198,6 +202,7 @@ wincaps wincap_2000sp4 __attribute__((section (".cygwin_dll_common"), shared)) =
has_recvmsg:false,
has_sendmsg:false,
has_broken_udf:true,
+ has_console_handle_problem:false,
};
wincaps wincap_xp __attribute__((section (".cygwin_dll_common"), shared)) = {
@@ -234,6 +239,7 @@ wincaps wincap_xp __attribute__((section (".cygwin_dll_common"), shared)) = {
has_recvmsg:true,
has_sendmsg:false,
has_broken_udf:true,
+ has_console_handle_problem:false,
};
wincaps wincap_xpsp1 __attribute__((section (".cygwin_dll_common"), shared)) = {
@@ -270,6 +276,7 @@ wincaps wincap_xpsp1 __attribute__((section (".cygwin_dll_common"), shared)) = {
has_recvmsg:true,
has_sendmsg:false,
has_broken_udf:true,
+ has_console_handle_problem:false,
};
wincaps wincap_xpsp2 __attribute__((section (".cygwin_dll_common"), shared)) = {
@@ -306,6 +313,7 @@ wincaps wincap_xpsp2 __attribute__((section (".cygwin_dll_common"), shared)) = {
has_recvmsg:true,
has_sendmsg:false,
has_broken_udf:true,
+ has_console_handle_problem:false,
};
wincaps wincap_2003 __attribute__((section (".cygwin_dll_common"), shared)) = {
@@ -342,6 +350,7 @@ wincaps wincap_2003 __attribute__((section (".cygwin_dll_common"), shared)) = {
has_recvmsg:true,
has_sendmsg:false,
has_broken_udf:true,
+ has_console_handle_problem:false,
};
wincaps wincap_vista __attribute__((section (".cygwin_dll_common"), shared)) = {
@@ -378,6 +387,44 @@ wincaps wincap_vista __attribute__((section (".cygwin_dll_common"), shared)) = {
has_recvmsg:true,
has_sendmsg:true,
has_broken_udf:false,
+ has_console_handle_problem:false,
+};
+
+wincaps wincap_7 __attribute__((section (".cygwin_dll_common"), shared)) = {
+ chunksize:0,
+ heapslop:0x4,
+ max_sys_priv:SE_CREATE_SYMBOLIC_LINK_PRIVILEGE,
+ is_server:false,
+ has_dacl_protect:true,
+ has_ip_helper_lib:true,
+ has_broken_if_oper_status:false,
+ has_physical_mem_access:false,
+ has_process_io_counters:true,
+ has_terminal_services:true,
+ has_create_global_privilege:true,
+ has_ioctl_storage_get_media_types_ex:true,
+ has_extended_priority_class:true,
+ has_guid_volumes:true,
+ has_disk_ex_ioctls:true,
+ has_disabled_user_tos_setting:true,
+ has_fileid_dirinfo:true,
+ has_exclusiveaddruse:true,
+ has_enhanced_socket_security:true,
+ has_buggy_restart_scan:false,
+ has_mandatory_integrity_control:true,
+ needs_logon_sid_in_sid_list:false,
+ needs_count_in_si_lpres2:true,
+ has_recycle_dot_bin:true,
+ has_gaa_prefixes:true,
+ has_gaa_on_link_prefix:true,
+ supports_all_posix_ai_flags:true,
+ has_restricted_stack_args:false,
+ has_transactions:true,
+ ts_has_dep_problem:false,
+ has_recvmsg:true,
+ has_sendmsg:true,
+ has_broken_udf:false,
+ has_console_handle_problem:true,
};
wincapc wincap __attribute__((section (".cygwin_dll_common"), shared));
@@ -441,7 +488,15 @@ wincapc::init ()
}
break;
case 6:
- caps = &wincap_vista;
+ switch (version.dwMinorVersion)
+ {
+ case 0:
+ caps = &wincap_vista;
+ break;
+ default:
+ caps = &wincap_7;
+ break;
+ }
break;
default:
caps = &wincap_unknown;
@@ -474,6 +529,7 @@ wincapc::init ()
{
((wincaps *)caps)->needs_count_in_si_lpres2 = false;
((wincaps *)caps)->has_restricted_stack_args = false;
+ ((wincaps *)caps)->has_console_handle_problem = false;
}
__small_sprintf (osnam, "NT-%d.%d", version.dwMajorVersion,
diff --git a/winsup/cygwin/wincap.h b/winsup/cygwin/wincap.h
index e3ab4d70d..c7097ab96 100644
--- a/winsup/cygwin/wincap.h
+++ b/winsup/cygwin/wincap.h
@@ -46,6 +46,7 @@ struct wincaps
unsigned has_recvmsg : 1;
unsigned has_sendmsg : 1;
unsigned has_broken_udf : 1;
+ unsigned has_console_handle_problem : 1;
};
class wincapc
@@ -98,6 +99,7 @@ public:
bool IMPLEMENT (has_recvmsg)
bool IMPLEMENT (has_sendmsg)
bool IMPLEMENT (has_broken_udf)
+ bool IMPLEMENT (has_console_handle_problem)
#undef IMPLEMENT
};