Make ccontrol abort when called as a specific gcc version.

Tony Breeds tony at bakeyournoodle.com
Wed Oct 24 12:03:03 EST 2007


The debian package includes a bunch of symlinks (I've sumbitted a bug
asking that they're removed) for various compilers which point to
ccontrol which leads to the following unexpected behaviour.

tony at thor:~$ which gcc-4.2
/usr/lib/ccontrol/gcc-4.2
tony at thor:~$ gcc-4.2 --version
i386-linux-gcc-4.0 (GCC) 4.0.4 20060904 (prerelease) (Debian 4.0.3-7)
Copyright (C) 2006 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

This patch causes ccontrol to abort if invoked as anyhing other than
cc, gcc, c++, g++, ld. make or (of course) ccontrol.

---
 ccontrol-identify.c |    8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

--- ccontrol-0.9.1+20060806/ccontrol-identify.c	2007-10-24 11:22:58.000000000 +1000
+++ ccontrol-0.9.1+20060806.mod/ccontrol-identify.c	2007-10-24 11:21:17.000000000 +1000
@@ -87,13 +87,13 @@
 	if (!basename)
 		basename = argv[0];
 
-	if (strstr(basename, "cc"))
+	if (streq(basename, "cc") || streq(basename, "gcc"))
 		return TYPE_CC;
-	else if (strstr(basename, "++"))
+	else if (streq(basename, "c++") || streq(basename, "g++"))
 		return TYPE_CPLUSPLUS;
-	else if (strstr(basename, "ld"))
+	else if (streq(basename, "ld"))
 		return TYPE_LD;
-	else if (strstr(basename, "make"))
+	else if (streq(basename, "make"))
 		return TYPE_MAKE;
 	else
 		fatal("unknown type of binary ", 0, argv[0], NULL);

Yours Tony

  linux.conf.au        http://linux.conf.au/ || http://lca2008.linux.org.au/
  Jan 28 - Feb 02 2008 The Australian Linux Technical Conference!




More information about the ccontrol mailing list