[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#41314: electric fence: ability to disable the banner



Package: electric-fence
Version: 2.0.5-4
Severity: wishlist

I have a program with a regression test suite; the tests include
checks that the program's stderr output is as expected.
Unfortunately, I can't test the program properly when linked with the
current version of Electric Fence because it fails all the tests - the
banner message causes the test harness to think the test program has
failed (or at least misbehaved) !

Please find below a patch which remedies this problem.  It provides a
new global external variable / environment variable
EF_DISABLE_BANNER.  This is documented, with a warning about the
risks of setting it (particularly as a variable).

I changed the debian/changelog (so that it would build well and
install on my system), but I didn't change the CHANGES file.

Bruce: the current Debian package lists your Pixar address in the
upstream tarfile.  Does this still work ?  I've also tried a
half-remembered hams.com address.

Ian.


Only in electric-fence-2.0.5: build
diff -ru orig/electric-fence-2.0.5/debian/changelog electric-fence-2.0.5/debian/changelog
--- orig/electric-fence-2.0.5/debian/changelog	Thu Jul 15 00:16:17 1999
+++ electric-fence-2.0.5/debian/changelog	Thu Jul 15 00:14:35 1999
@@ -1,3 +1,9 @@
+electric-fence (2.0.5-4.0.1) unstable; urgency=low
+
+  * Added support for EF_DISABLE_BANNER (- Ian Jackson).
+
+ -- Ian Jackson <ian@davenant.greenend.org.uk>  Thu, 15 Jul 1999 00:14:23 +0100
+
 electric-fence (2.0.5-4) unstable; urgency=low
 
   * recompiled for libc6; added an extra condition around the sys_errlist
Only in electric-fence-2.0.5/debian: changelog~
Only in electric-fence-2.0.5/debian: files
Only in electric-fence-2.0.5/debian: substvars
Only in electric-fence-2.0.5/debian: tmp
diff -ru orig/electric-fence-2.0.5/efence.3 electric-fence-2.0.5/efence.3
--- orig/electric-fence-2.0.5/efence.3	Fri Jan 20 07:12:58 1995
+++ electric-fence-2.0.5/efence.3	Thu Jul 15 00:13:43 1999
@@ -46,6 +46,12 @@
 .LP
 .nf
 .ft B
+extern int EF_DISABLE_BANNER;
+.ft
+.fi
+.LP
+.nf
+.ft B
 extern int EF_ALIGNMENT;
 .ft
 .fi
@@ -133,6 +139,15 @@
 the shell environment, or by setting the value of global integer variables
 using a debugger. These switches change what bugs Electric Fence will detect,
 so it's important that you know how to use them.
+.TP
+EF_DISABLE_BANNER
+This is an integer which if nonzero specifies that the usual Electric
+Fence banner and copyright notice should not be printed.  This is
+provided for certain circumstances where the banner can be annoying
+(eg, running a regression test suite that also monitors stderr).  Note
+that you should almost certainly not set this in your program, because
+then you might leave Electric Fence linked into the production
+version, which would be very bad.
 .TP
 EF_ALIGNMENT
 This is an integer that specifies the alignment for any memory allocations
Only in electric-fence-2.0.5: efence.3~
diff -ru orig/electric-fence-2.0.5/efence.c electric-fence-2.0.5/efence.c
--- orig/electric-fence-2.0.5/efence.c	Fri Jan 20 05:23:39 1995
+++ electric-fence-2.0.5/efence.c	Thu Jul 15 00:13:43 1999
@@ -79,6 +79,13 @@
 typedef struct _Slot	Slot;
 
 /*
+ * EF_DISABLE_BANNER is a global variable used to control whether
+ * Electric Fence prints its usual startup message.  If the value is
+ * -1, it will be set from the environment default to 0 at run time.
+ */
+int		EF_DISABLE_BANNER = -1;
+
+/*
  * EF_ALIGNMENT is a global variable used to control the default alignment
  * of buffers returned by malloc(), calloc(), and realloc(). It is all-caps
  * so that its name matches the name of the environment variable that is used
@@ -191,7 +198,15 @@
 	char *	string;
 	Slot *	slot;
 
-	EF_Print(version);
+	if ( EF_DISABLE_BANNER == -1 ) {
+		if ( (string = getenv("EF_DISABLE_BANNER")) != 0 )
+			EF_DISABLE_BANNER = atoi(string);
+		else
+			EF_DISABLE_BANNER = 0;
+	}
+
+	if ( EF_DISABLE_BANNER == 0 )
+	        EF_Print(version);
 
 	/*
 	 * Import the user's environment specification of the default
Only in electric-fence-2.0.5: efence.c~
Only in electric-fence-2.0.5: efence.o
Only in electric-fence-2.0.5: eftest
Only in electric-fence-2.0.5: libefence.so.0.0
Only in electric-fence-2.0.5: page.o
Only in electric-fence-2.0.5: print.o
Only in electric-fence-2.0.5: tstheap


Reply to: