This is the mail archive of the
cygwin-apps@cygwin.com
mailing list for the Cygwin project.
Re: Setup proposal: "Maintainer Features" #define and AC_ARG_ENABLE
- From: "Max Bowsher" <maxb at ukf dot net>
- To: "Robert Collins" <rbcollins at cygwin dot com>
- Cc: <cygwin-apps at cygwin dot com>
- Date: Wed, 15 Jan 2003 16:59:28 -0000
- Subject: Re: Setup proposal: "Maintainer Features" #define and AC_ARG_ENABLE
- References: <006501c2aba5$c26a86f0$f398883e@pomello><1040773504.17511.64.camel@lifelesswks> <00c001c2aba9$1ea6b620$f398883e@pomello> <1040775036.17074.70.camel@lifelesswks>
Sorry to be so long in replying.
Robert Collins wrote:
> On Wed, 2002-12-25 at 11:02, Max Bowsher wrote:
>> Robert Collins wrote:
>
>> A seperate global define is needed to enable this to be on when
>> DEBUG is off.
>
> Ok. Make them completely independent though: enabling debug will not
> enable those features, and vice verca.
Yes.
> *) A single flag to turn the features on.
Ok. CXXFLAGS+="-DMAINTAINER_FEATURES"
> *) It must not be visible via configure.
See below.
> *) When turned on they are activated via command line arguments to
> setup.exe.
Yes.
>> In any case, I'd like to make the points:
>> - We don't seem to get that many people compiling setup themselves.
>> - If someone turns on an --enable option, with the word maintainer
>> in its name, no less, without understanding it, its thoughroughly
>> their fault.
>
> Just so. As we don't have many people compiling setup, it will be no
> hardship not listing it in configure.
I *really* dislike deliberately obscuring something to help people who can't
be bothered think and explore.
But that's a minor point, so I won't argue about it.
Accordingly, here is the updated patch.
Note, I've replaced some sprintf calls with snprintf. The only way they can
overrun anyway is if someone compiles with -DMAINTAINER_FEATURES and then
specifies a really long alternate registry name, but it just felt better. I
haven't actually bothered to check the return value, though. I figured
silent truncation was acceptable in this case. (Given that this feature is
strictly maintainer-only).
----------------------------------------------------------------------------
--------------------------
Index: mount.cc
===================================================================
RCS file: /home/max/cvsmirror/cygwin-apps-cvs/setup/mount.cc,v
retrieving revision 2.14
diff -u -p -r2.14 mount.cc
--- mount.cc 2002/05/04 04:26:01 2.14
+++ mount.cc 2002/11/29 23:14:13
@@ -74,6 +74,14 @@ enum
#include "String++.h"
+#ifdef MAINTAINER_FEATURES
+#include "getopt++/GetOption.h"
+#include "getopt++/StringOption.h"
+static StringOption CygwinRegistryNameOption
(CYGWIN_INFO_CYGWIN_REGISTRY_NAME, '#', "override-registry-name", "Override
registry name to allow parallel installs for testing purposes");
+#undef CYGWIN_INFO_CYGWIN_REGISTRY_NAME
+#define CYGWIN_INFO_CYGWIN_REGISTRY_NAME
(((std::string)CygwinRegistryNameOption).c_str())
+#endif
+
/* Used when treating / and \ as equivalent. */
#define SLASH_P(ch) \
({ \
@@ -137,7 +145,7 @@ create_mount (String const posix, String
remove_mount (posix);
- sprintf (buf, "Software\\%s\\%s\\%s\\%s",
+ snprintf (buf, sizeof(buf), "Software\\%s\\%s\\%s\\%s",
CYGWIN_INFO_CYGNUS_REGISTRY_NAME,
CYGWIN_INFO_CYGWIN_REGISTRY_NAME,
CYGWIN_INFO_CYGWIN_MOUNT_REGISTRY_NAME, posix.cstr_oneuse ());
@@ -166,7 +174,7 @@ remove1 (HKEY rkey, String const posix)
{
char buf[1000];
- sprintf (buf, "Software\\%s\\%s\\%s\\%s",
+ snprintf (buf, sizeof(buf), "Software\\%s\\%s\\%s\\%s",
CYGWIN_INFO_CYGNUS_REGISTRY_NAME,
CYGWIN_INFO_CYGWIN_REGISTRY_NAME,
CYGWIN_INFO_CYGWIN_MOUNT_REGISTRY_NAME, posix.cstr_oneuse ());
@@ -223,7 +231,7 @@ set_cygdrive_flags (int istext, int issy
int found_system = 0;
char buf[1000];
- sprintf (buf, "Software\\%s\\%s\\%s",
+ snprintf (buf, sizeof(buf), "Software\\%s\\%s\\%s",
CYGWIN_INFO_CYGNUS_REGISTRY_NAME,
CYGWIN_INFO_CYGWIN_REGISTRY_NAME,
CYGWIN_INFO_CYGWIN_MOUNT_REGISTRY_NAME);
@@ -366,7 +374,7 @@ read_mounts ()
arbitrarily large number of mounts. */
for (int issystem = 0; issystem <= 1; issystem++)
{
- sprintf (buf, "Software\\%s\\%s\\%s",
+ snprintf (buf, sizeof(buf), "Software\\%s\\%s\\%s",
CYGWIN_INFO_CYGNUS_REGISTRY_NAME,
CYGWIN_INFO_CYGWIN_REGISTRY_NAME,
CYGWIN_INFO_CYGWIN_MOUNT_REGISTRY_NAME);
----------------------------------------------------------------------------
--------------------------