diff options
author | Corinna Vinschen <corinna@vinschen.de> | 2016-03-19 15:21:18 +0300 |
---|---|---|
committer | Corinna Vinschen <corinna@vinschen.de> | 2016-03-19 15:21:18 +0300 |
commit | e42f66d00f450a643e1920aa28037188aa1f2f7c (patch) | |
tree | aac991408054a988bafae7864a1744546852255c /winsup | |
parent | d17977ccc70278101b605da51b6e96f8b3c9e44b (diff) |
Remove ill-advised cygwin_props
Cygwin_props have been invented to allow switching off the unique
installation keys in the first place, supposedly for debugging.
This never really was a good idea, after all we *want* the installations
to be independent and there's no good reason to break that, not even
for debugging purposes.
Other than that, cygwin_props were meant to be used for some other global
settings which never took place. There's just no good reason to tweak
the DLL binary invisibly where a setting could be done in a file or the
environment.
This patch removes the cygwin_props entirely, including the related
settings in cygcheck.
cygwin:
* cygprops.h: Remove file.
* globals.cc (cygwin_props): Remove.
* cygheap.cc (init_cygheap::init_installation_root): Drop removing
installation key.
utils:
* cygcheck.cc: Drop including cygprops.h. Remove now unused option
values.
(unique_object_name_opt): Remove.
(handle_unique_object_name): Remove function.
(usage): Remove text for unique-object-names options.
(longopts): Remove unique-object-names options.
(main): Drop handling unique-object-names options.
doc:
* utils.xml (cygcheck): Remove text for unique-object-names options.
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
Diffstat (limited to 'winsup')
-rw-r--r-- | winsup/cygwin/cygheap.cc | 6 | ||||
-rw-r--r-- | winsup/cygwin/cygprops.h | 21 | ||||
-rw-r--r-- | winsup/cygwin/globals.cc | 14 | ||||
-rw-r--r-- | winsup/doc/utils.xml | 58 | ||||
-rw-r--r-- | winsup/utils/cygcheck.cc | 117 |
5 files changed, 1 insertions, 215 deletions
diff --git a/winsup/cygwin/cygheap.cc b/winsup/cygwin/cygheap.cc index 4932cf0b1..7a18d18a6 100644 --- a/winsup/cygwin/cygheap.cc +++ b/winsup/cygwin/cygheap.cc @@ -219,12 +219,6 @@ init_cygheap::init_installation_root () installation_root))) break; } - - if (cygwin_props.disable_key) - { - installation_key.Length = 0; - installation_key.Buffer[0] = L'\0'; - } } void __stdcall diff --git a/winsup/cygwin/cygprops.h b/winsup/cygwin/cygprops.h deleted file mode 100644 index 70ea3cc5a..000000000 --- a/winsup/cygwin/cygprops.h +++ /dev/null @@ -1,21 +0,0 @@ -/* cygprops.h: Cygwin DLL properties - - Copyright 2009, 2012 Red Hat, Inc. - -This file is part of Cygwin. - -This software is a copyrighted work licensed under the terms of the -Cygwin license. Please consult the file "CYGWIN_LICENSE" for -details. */ - -#pragma once -/* DLL properties data. */ -struct cygwin_props_t -{ - char magic[68]; - ULONG size; - ULONG disable_key; -}; - -#define CYGWIN_PROPS_MAGIC \ - "Fortunately, I keep my feathers numbered for just such an emergency" diff --git a/winsup/cygwin/globals.cc b/winsup/cygwin/globals.cc index 80e0f0db3..990158e92 100644 --- a/winsup/cygwin/globals.cc +++ b/winsup/cygwin/globals.cc @@ -13,7 +13,6 @@ details. */ #include "winsup.h" #include "cygtls.h" #include "perprocess.h" -#include "cygprops.h" #include "thread.h" #include <malloc.h> #include <cygwin/version.h> @@ -160,19 +159,6 @@ const int __collate_load_error = 0; extern UNICODE_STRING _RDATA ro_u_natdev = _ROU (L"Device"); #undef _ROU - /* Cygwin properties are meant to be readonly data placed in the DLL, but - which can be changed by external tools to make adjustments to the - behaviour of a DLL based on the binary of the DLL itself. This is - different from $CYGWIN since it only affects that very DLL, not all - DLLs which have access to the $CYGWIN environment variable. We use the - same _RDATA trick as for the above UNICODE_STRINGs. */ - extern cygwin_props_t _RDATA cygwin_props = - { - CYGWIN_PROPS_MAGIC, - sizeof (cygwin_props_t), - 0 - }; - /* This is an exported copy of environ which can be used by DLLs which use cygwin.dll. */ char **__cygwin_environ; diff --git a/winsup/doc/utils.xml b/winsup/doc/utils.xml index a904c34fd..8c5a619b8 100644 --- a/winsup/doc/utils.xml +++ b/winsup/doc/utils.xml @@ -35,9 +35,6 @@ cygcheck -f FILE [FILE]... cygcheck -l [PACKAGE]... cygcheck -p REGEXP cygcheck --delete-orphaned-installation-keys -cygcheck --enable-unique-object-names Cygwin-DLL -cygcheck --disable-unique-object-names Cygwin-DLL -cygcheck --show-unique-object-names Cygwin-DLL cygcheck -h </screen> </refsynopsisdiv> @@ -63,15 +60,6 @@ At least one command option or a PROGRAM is required, as shown above. Delete installation keys of old, now unused installations from the registry. Requires the right to change the registry. - --enable-unique-object-names Cygwin-DLL - --disable-unique-object-names Cygwin-DLL - --show-unique-object-names Cygwin-DLL - Enable, disable, or show the setting of the - \"unique object names\" setting in the Cygwin DLL - given as argument to this option. The DLL path must - be given as valid Windows(!) path. - See the users guide for more information. - If you don't know what this means, don't change it. -v, --verbose produce more verbose output -h, --help annotate output with explanatory comments when given with another command, otherwise print this help @@ -227,52 +215,6 @@ coreutils-5.3.0-6 GNU core utilities (includes fileutils, sh-utils and t which the installation doesn't exist anymore. To get rid of these orphaned registry entries, use the <command>cygcheck --delete-orphaned-installation-keys</command> command.</para> - - <para> Each Cygwin DLL generates a key value from its installation path. - This value is not only stored in the registry, it's also used to generate - global object names used for interprocess communication. This keeps - different Cygwin installations separate. Processes running under a Cygwin - DLL installed in C:\cygwin don't see processes running under a Cygwin DLL - installed in C:\Program Files\cygwin. This allows running multiple - versions of Cygwin DLLs without these versions to interfere with each - other, or to run small third-party installations for a specific purpose - independently from a Cygwin net distribution. </para> - - <para> For debugging purposes it could be desired that the various Cygwin - DLLs use the same key, independently from their installation paths. If - the DLLs have different versions, trying to run processes under these - DLLs concurrently will result in error messages like this one:</para> - - <screen> -*** shared version mismatch detected - 0x8A88009C/0x75BE0074. -This problem is probably due to using incompatible versions of the Cygwin DLL. -Search for cygwin1.dll using the Windows Start->Find/Search facility -and delete all but the most recent version. The most recent version *should* -reside in x:\\cygwin\\bin, where 'x' is the drive on which you have -installed the cygwin distribution. Rebooting is also suggested if you -are unable to find another Cygwin DLL. -</screen> - - <para> To disable the usage of a unique key value of a certain Cygwin DLL, - use the <command>cygcheck --disable-unique-object-names - Cygwin-DLL</command> command. <literal>Cygwin-DLL</literal> is the - Windows path (*not* a Cygwin POSIX path) to the DLL for which you want to - disable this feature. Note that you have to stop all Cygwin processes - running under this DLL, before you're allowed to change this setting. For - instance, run <command>cygcheck</command> from a DOS command line for - this purpose.</para> - - <para>To re-enable the usage of a unique key, use the <command>cygcheck - --enable-unique-object-names Cygwin-DLL</command> command. This option - has the same characteristics as the - <literal>--disable-unique-object-names</literal> option</para> - - <para>Finally, you can use <command>cygcheck --show-unique-object-names - Cygwin-DLL</command> to find out if the given Cygwin DLL use unique - object names or not. In contrast to the <literal>--disable-...</literal> - and <literal>--enable-...</literal> options, the - <literal>--show-unique-object-names</literal> option also works for - Cygwin DLLs which are currently in use.</para> </refsect1> </refentry> diff --git a/winsup/utils/cygcheck.cc b/winsup/utils/cygcheck.cc index d0ac4a5e9..d3c7d5d97 100644 --- a/winsup/utils/cygcheck.cc +++ b/winsup/utils/cygcheck.cc @@ -27,7 +27,6 @@ #include "../cygwin/include/sys/cygwin.h" #define _NOMNTENT_MACROS #include "../cygwin/include/mntent.h" -#include "../cygwin/cygprops.h" #undef cygwin_internal #include "loadlib.h" @@ -50,7 +49,6 @@ int find_package = 0; int list_package = 0; int grep_packages = 0; int del_orphaned_reg = 0; -int unique_object_name_opt = 0; static char emptystr[] = ""; @@ -132,9 +130,6 @@ static common_apps[] = { enum { CO_DELETE_KEYS = 0x100, - CO_ENABLE_UON = 0x101, - CO_DISABLE_UON = 0x102, - CO_SHOW_UON = 0x103 }; static int num_paths, max_paths; @@ -1341,89 +1336,6 @@ memmem (char *haystack, size_t haystacklen, return NULL; } -int -handle_unique_object_name (int opt, char *path) -{ - HANDLE fh, fm; - void *haystack = NULL; - - if (!path || !*path) - usage (stderr, 1); - - DWORD access, share, protect, mapping; - - if (opt == CO_SHOW_UON) - { - access = GENERIC_READ; - share = FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE; - protect = PAGE_READONLY; - mapping = FILE_MAP_READ; - } - else - { - access = GENERIC_READ | GENERIC_WRITE; - share = 0; - protect = PAGE_READWRITE; - mapping = FILE_MAP_WRITE; - } - - fh = CreateFile (path, access, share, NULL, OPEN_EXISTING, - FILE_FLAG_BACKUP_SEMANTICS, NULL); - if (fh == INVALID_HANDLE_VALUE) - { - DWORD err = GetLastError (); - switch (err) - { - case ERROR_SHARING_VIOLATION: - display_error ("%s still used by other Cygwin processes.\n" - "Please stop all of them and retry.", path); - break; - case ERROR_ACCESS_DENIED: - display_error ( - "Your permissions are not sufficient to change the file \"%s\"", - path); - break; - case ERROR_FILE_NOT_FOUND: - display_error ("%s: No such file.", path); - break; - default: - display_error (path, true, false); - break; - } - return 1; - } - if (!(fm = CreateFileMapping (fh, NULL, protect, 0, 0, NULL))) - display_error ("CreateFileMapping"); - else if (!(haystack = MapViewOfFile (fm, mapping, 0, 0, 0))) - display_error ("MapViewOfFile"); - else - { - size_t haystacklen = GetFileSize (fh, NULL); - cygwin_props_t *cygwin_props = (cygwin_props_t *) - memmem ((char *) haystack, haystacklen, - CYGWIN_PROPS_MAGIC, sizeof (CYGWIN_PROPS_MAGIC)); - if (!cygwin_props) - display_error ("Can't find Cygwin properties in %s", path); - else - { - if (opt != CO_SHOW_UON) - cygwin_props->disable_key = opt - CO_ENABLE_UON; - printf ("Unique object names are %s\n", - cygwin_props->disable_key ? "disabled" : "enabled"); - UnmapViewOfFile (haystack); - CloseHandle (fm); - CloseHandle (fh); - return 0; - } - } - if (haystack) - UnmapViewOfFile (haystack); - if (fm) - CloseHandle (fm); - CloseHandle (fh); - return 1; -} - extern "C" NTSTATUS NTAPI RtlGetVersion (PRTL_OSVERSIONINFOEXW); static void @@ -2231,9 +2143,6 @@ Usage: cygcheck [-v] [-h] PROGRAM\n\ cygcheck -l [PACKAGE]...\n\ cygcheck -p REGEXP\n\ cygcheck --delete-orphaned-installation-keys\n\ - cygcheck --enable-unique-object-names Cygwin-DLL\n\ - cygcheck --disable-unique-object-names Cygwin-DLL\n\ - cygcheck --show-unique-object-names Cygwin-DLL\n\ cygcheck -h\n\n\ List system information, check installed packages, or query package database.\n\ \n\ @@ -2255,15 +2164,6 @@ At least one command option or a PROGRAM is required, as shown above.\n\ Delete installation keys of old, now unused\n\ installations from the registry. Requires the right\n\ to change the registry.\n\ - --enable-unique-object-names Cygwin-DLL\n\ - --disable-unique-object-names Cygwin-DLL\n\ - --show-unique-object-names Cygwin-DLL\n\ - Enable, disable, or show the setting of the\n\ - \"unique object names\" setting in the Cygwin DLL\n\ - given as argument to this option. The DLL path must\n\ - be given as valid Windows(!) path.\n\ - See the users guide for more information.\n\ - If you don't know what this means, don't change it.\n\ -v, --verbose produce more verbose output\n\ -h, --help annotate output with explanatory comments when given\n\ with another command, otherwise print this help\n\ @@ -2287,9 +2187,6 @@ struct option longopts[] = { {"list-package", no_argument, NULL, 'l'}, {"package-query", no_argument, NULL, 'p'}, {"delete-orphaned-installation-keys", no_argument, NULL, CO_DELETE_KEYS}, - {"enable-unique-object-names", no_argument, NULL, CO_ENABLE_UON}, - {"disable-unique-object-names", no_argument, NULL, CO_DISABLE_UON}, - {"show-unique-object-names", no_argument, NULL, CO_SHOW_UON}, {"help", no_argument, NULL, 'h'}, {"version", no_argument, 0, 'V'}, {0, no_argument, NULL, 0} @@ -2426,11 +2323,6 @@ main (int argc, char **argv) case CO_DELETE_KEYS: del_orphaned_reg = 1; break; - case CO_ENABLE_UON: - case CO_DISABLE_UON: - case CO_SHOW_UON: - unique_object_name_opt = i; - break; case 'V': print_version (); exit (0); @@ -2454,7 +2346,7 @@ main (int argc, char **argv) } if ((check_setup || sysinfo || find_package || list_package || grep_packages - || del_orphaned_reg || unique_object_name_opt) + || del_orphaned_reg) && keycheck) usage (stderr, 1); @@ -2462,11 +2354,6 @@ main (int argc, char **argv) && (check_setup || del_orphaned_reg)) usage (stderr, 1); - if ((check_setup || sysinfo || find_package || list_package || grep_packages - || del_orphaned_reg) - && unique_object_name_opt) - usage (stderr, 1); - if (dump_only && !check_setup && !sysinfo) usage (stderr, 1); @@ -2475,8 +2362,6 @@ main (int argc, char **argv) if (keycheck) return check_keys (); - if (unique_object_name_opt) - return handle_unique_object_name (unique_object_name_opt, *argv); if (del_orphaned_reg) del_orphaned_reg_installations (); if (grep_packages) |