From: Amos Jeffries Date: Fri, 6 Mar 2009 07:36:36 +0000 (+1300) Subject: Author: Francesco Chemolli X-Git-Tag: SQUID_3_2_0_1~1138 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=af28bfbd86614960b287b28999bfaab82e789963;p=thirdparty%2Fsquid.git Author: Francesco Chemolli Bug 2608: Build broken by Linux basename() implementation. This patch implements a replacement for the call to basename() in debugs(). It involves a hard-coded relative test location for debugs.cc used as an anchor within the __FILE__ path. This relative path MUST be updated whenever debugs.cc is moved. debugs() is no longer valid to be used within auto-generated files which may retain a completely different relative base path. --- af28bfbd86614960b287b28999bfaab82e789963 diff --cc configure.in index 0fd7ef57f0,8fb385d12a..37ddb5ae81 --- a/configure.in +++ b/configure.in @@@ -2244,7 -2229,7 +2244,6 @@@ AC_CHECK_HEADERS( ip_nat.h \ ipl.h \ libc.h \ -- libgen.h \ limits.h \ malloc.h \ math.h \ diff --cc src/Debug.h index f9cec79b0b,a668c9023e..2322bb5228 --- a/src/Debug.h +++ b/src/Debug.h @@@ -86,6 -80,8 +80,10 @@@ private extern FILE *debug_log; -SQUIDCEXTERN const char* SkipBuildPrefix(const char* path); ++const size_t BuildPrefixInit(); ++const char * SkipBuildPrefix(const char* path); ++ + /* Debug stream */ #define debugs(SECTION, LEVEL, CONTENT) \ do { \ diff --cc src/cf_gen.cc index 0180906a27,0180906a27..8ad00de525 --- a/src/cf_gen.cc +++ b/src/cf_gen.cc @@@ -663,7 -663,7 +663,6 @@@ gen_parse(Entry * head, FILE * fp "parse_line(char *buff)\n" "{\n" "\tchar\t*token;\n" -- "\tdebugs(0, 10, \"parse_line: \" << buff << \"\\n\" );\n" "\tif ((token = strtok(buff, w_space)) == NULL) \n" "\t\treturn 1;\t/* ignore empty lines */\n" ); diff --cc src/debug.cc index 466e4820d5,ea02e8d4e7..bbd9da8c6d --- a/src/debug.cc +++ b/src/debug.cc @@@ -31,6 -31,12 +31,7 @@@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA. * */ + -/* Anyone moving the src/Debug.cc file MUST record its new location here, - * or there will be issues in the debugging statements, possibly fatal! - */ -#define RELATIVE_PATH_TO_DEBUG_CC "src/debug.cc" - #include "config.h" #include "Debug.h" #include "SquidTime.h" @@@ -746,3 -752,18 +747,27 @@@ Debug::xassert(const char *msg, const c } std::ostringstream (*Debug::CurrentDebug)(NULL); + -static const size_t BuildPrefixInit() ++const size_t ++BuildPrefixInit() + { ++ ++ /* Anyone moving the src/Debug.cc file MUST record its new location here, ++ * or there will be issues in the debugging statements, possibly fatal! ++ */ ++ ++ const char *ThisFileNameTail = "src/debug.cc"; ++ + //leave immediately if misconfigured. Unfortunately not possible to detect at build + const char *file=__FILE__; - const char *rptdcc=RELATIVE_PATH_TO_DEBUG_CC; - assert(strstr(file,rptdcc)!=NULL); - return strlen(file)-strlen(rptdcc); ++ assert(strstr(file,ThisFileNameTail)!=NULL); ++ return strlen(file)-strlen(ThisFileNameTail); + } -static const size_t BuildPrefixLength=BuildPrefixInit(); -const char* SkipBuildPrefix(const char* path) ++ ++const char* ++SkipBuildPrefix(const char* path) + { ++ static const size_t BuildPrefixLength = BuildPrefixInit(); ++ + return path+BuildPrefixLength; + } -