From: Amos Jeffries Date: Sun, 26 Oct 2008 01:40:10 +0000 (+1300) Subject: Various Build Fixes X-Git-Tag: SQUID_3_2_0_1~1377 X-Git-Url: http://git.ipfire.org/gitweb/?a=commitdiff_plain;h=da783331e709f83ae1f461b4c228dc8a8232bf17;p=thirdparty%2Fsquid.git Various Build Fixes Adjust build tests to work out-of-tree in a custom directory tree per run. Fixes several compile errors uncovered by the above. Fixes ESILibxml2Parser to use memory-safe snprintf. --- diff --git a/errors/Makefile.am b/errors/Makefile.am index 9a0f90cde2..46afda9d26 100644 --- a/errors/Makefile.am +++ b/errors/Makefile.am @@ -73,13 +73,13 @@ install-data-local: done; \ fi \ done; \ - $(INSTALL_DATA) $(srcdir)/errorpage.css $(DESTDIR)$(DEFAULT_STYLESHEET).default; \ - @if test -f $(DESTDIR)$(DEFAULT_STYLESHEET) ; then \ - echo "$@ will not overwrite existing $(DESTDIR)$(DEFAULT_STYLESHEET)" ; \ - else \ - echo "$(INSTALL_DATA) $(srcdir)/errorpage.css $(DESTDIR)$(DEFAULT_STYLESHEET)"; \ - $(INSTALL_DATA) $(srcdir)/errorpage.css $(DESTDIR)$(DEFAULT_STYLESHEET); \ - fi + $(INSTALL_DATA) $(srcdir)/errorpage.css $(DESTDIR)$(DEFAULT_STYLESHEET).default; \ + if test -f $(DESTDIR)$(DEFAULT_STYLESHEET) ; then \ + echo "$@ will not overwrite existing $(DESTDIR)$(DEFAULT_STYLESHEET)" ; \ + else \ + echo "$(INSTALL_DATA) $(srcdir)/errorpage.css $(DESTDIR)$(DEFAULT_STYLESHEET)"; \ + $(INSTALL_DATA) $(srcdir)/errorpage.css $(DESTDIR)$(DEFAULT_STYLESHEET); \ + fi uninstall-local: diff --git a/src/ESIExpatParser.cc b/src/ESIExpatParser.cc index ada05ebcd6..c7e0e85dac 100644 --- a/src/ESIExpatParser.cc +++ b/src/ESIExpatParser.cc @@ -34,6 +34,9 @@ */ #include "squid.h" + +#if USE_SQUID_ESI + #include "ESIExpatParser.h" RegisterESIParser("expat", ESIExpatParser); @@ -104,3 +107,5 @@ ESIExpatParser::errorString() const { return XML_ErrorString(XML_GetErrorCode(myParser())); } + +#endif /* USE_SQUID_ESI */ diff --git a/src/ESILibxml2Parser.cc b/src/ESILibxml2Parser.cc index 989b75be13..1c5e0186ba 100644 --- a/src/ESILibxml2Parser.cc +++ b/src/ESILibxml2Parser.cc @@ -38,14 +38,10 @@ */ #include "squid.h" -#include "ESILibxml2Parser.h" -#ifdef sprintf -// ugly, but needed to use correct sprintf function below -#undef sprintf -#endif +#if USE_SQUID_ESI -#include +#include "ESILibxml2Parser.h" // the global document that will store the resolved entity // definitions @@ -99,7 +95,7 @@ xmlEntityPtr esi_getEntitySAXFunc(void * ctx, const xmlChar * name) if (ent != NULL) { char tmp[32]; - sprintf(tmp, "&#%d;", ent->value); + snprintf(tmp, 32, "&#%d;", ent->value); res = xmlAddDocEntity(entity_doc, (const xmlChar *)name, XML_INTERNAL_GENERAL_ENTITY, NULL, NULL, (const xmlChar *)tmp); } } @@ -154,3 +150,5 @@ ESILibxml2Parser::errorString() const return error->message; } + +#endif /* USE_SQUID_ESI */ diff --git a/test-builds.sh b/test-builds.sh index 5014e0e19e..1e02054fb0 100755 --- a/test-builds.sh +++ b/test-builds.sh @@ -6,7 +6,9 @@ tmp="${1}" if test -e ./test-suite/buildtests/os-${tmp}.opts ; then echo "TESTING: ${tmp}" - ./test-suite/buildtest.sh ./test-suite/buildtests/os-${tmp} + rm -f -r btos${tmp} && mkdir btos${tmp} && cd btos${tmp} + ../test-suite/buildtest.sh ../test-suite/buildtests/os-${tmp} + cd .. fi # @@ -18,8 +20,11 @@ fi # for f in `ls -1 ./test-suite/buildtests/layer*.opts` ; do + layer=`echo "${f}" | grep -o -E "layer-[0-9]*-[^\.]*"` + rm -f -r btl${layer} && mkdir btl${layer} && cd btl${layer} arg=`echo "${f}" | sed s/\\.opts//` echo "TESTING: ${arg}" - ./test-suite/buildtest.sh "${arg}" || + ../test-suite/buildtest.sh ".${arg}" || ( grep -E "^ERROR|\ error:\ " buildtest_*.log && exit 1 ) + cd .. done diff --git a/test-suite/buildtest.sh b/test-suite/buildtest.sh index 94403634e9..b7f6c3671a 100755 --- a/test-suite/buildtest.sh +++ b/test-suite/buildtest.sh @@ -32,8 +32,7 @@ make -k distclean || echo "distclean done. errors are unwanted but okay here." # above command currently encounters dependancy problems on cleanup. # rm -f -r src/fs/aufs/.deps src/fs/diskd/.deps && - ./bootstrap.sh && - ./configure --silent ${OPTS} 2>&1 && + ../configure --silent ${OPTS} 2>&1 && make check 2>&1 && make 2>&1