Re: CrossCompile

2010-08-28 Thread Amos Jeffries

Henrik Nordström wrote:

How I have done it in the past is to use a configure cache presetting
the runtime test appropriately for the target.

But this requires that all AC_TRY_RUN checks are made cacheable.



The ./configure raw code shows that the autoconf people use [:] in their 
own run-time test macros. Our ones with just [] expand into that error 
message. But changing ours to [:], or in some cases a nice local message 
seems to remove the auto-warnings.


I *think* this will remove the need for such pre-seeding.

The cf_gen remains a problem though. I really think we should go back to 
having that as a perl script. All its doing is text-manipulation or 
arrays during build and the code needed to switch build-hosts underneath 
automake so it can run is not trivial.


Amos
--
Please be using
  Current Stable Squid 2.7.STABLE9 or 3.1.7
  Beta testers wanted for 3.2.0.1


[PATCH v1] unit-tests for request first-line parser.

2010-08-28 Thread Amos Jeffries
One of our users uncovered a nasty bug in 3.1 today. Squid hangs on some 
simple requests.


On investigating I found that an update to make it return errors had 
used the wrong result code in a few places. Causing it to loop trying to 
read more data and complete the first line which was already complete.


The parser function also has no unit tests to verify correct operation. 
Included in this patch is a draft outline for some unit-tests.


If anyone has suggestions or knowledge of other input cases please speak 
up; good, bad AND ugly examples wanted.


Amos
--
Please be using
  Current Stable Squid 2.7.STABLE9 or 3.1.7
  Beta testers wanted for 3.2.0.1
=== modified file 'src/HttpMsg.cc'
--- src/HttpMsg.cc	2010-08-24 20:35:02 +
+++ src/HttpMsg.cc	2010-08-29 06:17:10 +
@@ -394,15 +394,28 @@
 void
 HttpParserInit(HttpParser *hdr, const char *buf, int bufsiz)
 {
+hdr->clear();
 hdr->state = 1;
-hdr->request_parse_status = HTTP_STATUS_NONE;
 hdr->buf = buf;
 hdr->bufsiz = bufsiz;
-hdr->req_start = hdr->req_end = -1;
-hdr->hdr_start = hdr->hdr_end = -1;
 debugs(74, 5, "httpParseInit: Request buffer is " << buf);
 }
 
+void
+HttpParser::clear()
+{
+state = 0; // ?
+buf = NULL;
+bufsiz = 0;
+req_start = req_end = -1;
+hdr_start = hdr_end = -1;
+m_start = m_end = -1;
+u_start = u_end = -1;
+v_start = v_end = -1;
+v_maj = v_min = 0;
+request_parse_status = HTTP_STATUS_NONE;
+}
+
 #if MSGDODEBUG
 /* XXX This should eventually turn into something inlined or #define'd */
 int
@@ -484,9 +497,15 @@
 }
 }
 if (hmsg->req_end == -1) {
-retcode = 0;
-goto finish;
+PROF_stop(HttpParserParseReqLine);
+debugs(74, 5, "Parser: retval 0: from " << hmsg->req_start <<
+   "->" << hmsg->req_end << ": needs more data to complete first line.");
+return 0; // This is the only spot in this function where (0) is valid result.
 }
+
+// NP: we have now seen EOL, more-data (0) cannot occur.
+// From here on any failure is -1, success is 1
+
 assert(hmsg->buf[hmsg->req_end] == '\n');
 /* Start at the beginning again */
 i = 0;
@@ -494,7 +513,7 @@
 /* Find first non-whitespace - beginning of method */
 for (; i < hmsg->req_end && (xisspace(hmsg->buf[i])); i++);
 if (i >= hmsg->req_end) {
-retcode = 0;
+retcode = -1;
 goto finish;
 }
 hmsg->m_start = i;
@@ -503,7 +522,7 @@
 /* Find first whitespace - end of method */
 for (; i < hmsg->req_end && (! xisspace(hmsg->buf[i])); i++);
 if (i >= hmsg->req_end) {
-retcode = 0;
+retcode = -1;
 goto finish;
 }
 hmsg->m_end = i - 1;
@@ -511,7 +530,7 @@
 /* Find first non-whitespace - beginning of URL+Version */
 for (; i < hmsg->req_end && (xisspace(hmsg->buf[i])); i++);
 if (i >= hmsg->req_end) {
-retcode = 0;
+retcode = -1;
 goto finish;
 }
 hmsg->u_start = i;
@@ -534,7 +553,7 @@
 }
 }
 if (i > hmsg->req_end) {
-retcode = 0;
+retcode = -1;
 goto finish;
 }
 
@@ -555,7 +574,7 @@
 /* XXX why <= vs < ? I do need to really re-audit all of this ..*/
 for (i = last_whitespace; i <= hmsg->req_end && xisspace(hmsg->buf[i]); i++);
 if (i > hmsg->req_end) {
-retcode = 0;
+retcode = -1;
 goto finish;
 }
 
@@ -581,17 +600,17 @@
 goto finish;
 }
 if (i >= hmsg->req_end) {
-retcode = 0;
+retcode = -1;
 goto finish;
 }
 
 /* next should be .; we -have- to have this as we have a whole line.. */
 if (hmsg->buf[i] != '.') {
-retcode = 0;
+retcode = -1;
 goto finish;
 }
 if (i + 1 >= hmsg->req_end) {
-retcode = 0;
+retcode = -1;
 goto finish;
 }
 
@@ -631,4 +650,3 @@
 
 return retcode;
 }
-

=== modified file 'src/HttpMsg.h'
--- src/HttpMsg.h	2010-08-19 00:12:43 +
+++ src/HttpMsg.h	2010-08-29 03:04:53 +
@@ -130,6 +130,10 @@
 class HttpParser
 {
 public:
+/// reset all fields to empty values.
+void clear();
+
+public:
 char state;
 const char *buf;
 int bufsiz;

=== modified file 'src/tests/testHttpRequest.cc'
--- src/tests/testHttpRequest.cc	2010-08-16 14:47:39 +
+++ src/tests/testHttpRequest.cc	2010-08-29 04:03:49 +
@@ -199,3 +199,338 @@
 input.reset();
 error = HTTP_STATUS_NONE;
 }
+
+void
+testHttpRequest::testParseRequestLine()
+{
+MemBuf input;
+HttpParser output;
+size_t hdr_len;
+input.init();
+
+// Valid States
+
+// HTTP/0.9 simple-request
+input.append("GET /\r\n", 7);
+HttpParserInit(&output, input.content(), input.contentSize());
+CPPUNIT_ASSERT(HttpParserPars

Re: CrossCompile

2010-08-28 Thread Henrik Nordström
How I have done it in the past is to use a configure cache presetting
the runtime test appropriately for the target.

But this requires that all AC_TRY_RUN checks are made cacheable.


ons 2010-08-25 klockan 19:16 -0600 skrev Alex Rousskov:
> Forwarding from info@ to squid-dev@:
> 
> On 08/25/2010 12:12 PM, kromo...@user-helfen-usern.de wrote:
> > Hi,
> >
> > I need to cross compile squid for http://squidsheep.org but I only get
> > message:
> >
> > configure: error: cannot run test program while cross compiling
> >
> > Is there a way to crosscompile 3.1.6, without creating a complete
> > buildsystem onto a planned tiny linux?
> >
> > Best regards
> > Bob Kromonos Achten
> >




Re: CrossCompile

2010-08-28 Thread Amos Jeffries

kromo...@user-helfen-usern.de wrote:

Hi,

I've attached config.log. Hope, it could help.
Regards

Kromonos


Am Sat, 28 Aug 2010 schrieb Amos Jeffries:


Am Thu, 26 Aug 2010 schrieb Amos Jeffries:


On Wed, 25 Aug 2010 19:16:54 -0600, Alex Rousskov
 wrote:

Forwarding from info@ to squid-dev@:

On 08/25/2010 12:12 PM, kromo...@user-helfen-usern.de wrote:

Hi,

I need to cross compile squid for http://squidsheep.org but I only get
message:

configure: error: cannot run test program while cross compiling

Is there a way to crosscompile 3.1.6, without creating a complete
buildsystem onto a planned tiny linux?

Best regards
Bob Kromonos Achten


A fair bit of emphasis was put on cross-compiling recently, but some
problems remain, particularly in the 3.0 and 3.1 configure scripts. Can you
test todays 3.2 beta release snapshot and see if it does much better?


kromo...@user-helfen-usern.de wrote:

Hi,

thanks for answer :)
I've tested with every version > 3.1.6. Same problem with every version
:(



Looks like our attempts to use [] to specify non-action for 
cross-compilers does not work. I'm checking some alternatives now.


Amos
--
Please be using
  Current Stable Squid 2.7.STABLE9 or 3.1.7
  Beta testers wanted for 3.2.0.1


Re: Squidclient doesn't build in head

2010-08-28 Thread Amos Jeffries

Thanks Markus. That worked.

Amos
--
Please be using
  Current Stable Squid 2.7.STABLE9 or 3.1.7
  Beta testers wanted for 3.2.0.1


Hudson build is back to normal : 3.HEAD-i386-opensolaris #433

2010-08-28 Thread noc
See 




Re: Squidclient doesn't build in head

2010-08-28 Thread Amos Jeffries

Markus Moeller wrote:
"Kinkie"  wrote in message 
news:aanlktikt2zra7o+s8zrjj2abs==jbiw3dl8xtxnrb...@mail.gmail.com...

Hi all,
 Kerberos integration in squidclient has caused some problems with 
squidclient;


Ubuntu 10.4 fails with
/home/kinkie/squid/workspace/stringng/tools/squidclient.cc:857:
undefined reference to `gss_release_buffer'
/home/kinkie/squid/workspace/stringng/tools/squidclient.cc:850:
undefined reference to `gss_display_status'
/home/kinkie/squid/workspace/stringng/tools/squidclient.cc:854:
undefined reference to `gss_release_buffer'

Opensolaris instead complains that
../../tools/squidclient.cc: In function `char* GSSAPI_token(const 
char*)':

../../tools/squidclient.cc:912: error: `gss_nt_service_name'
undeclared (first use this function)


I couldn't find a simple way to fix this.. any hints?



Does this fix it ?



Much cleaner and clearer to read than what was there before.
Applied as polish anyway and build kicked to test if its fixes anything.

Amos
--
Please be using
  Current Stable Squid 2.7.STABLE9 or 3.1.7
  Beta testers wanted for 3.2.0.1


Re: Squidclient doesn't build in head

2010-08-28 Thread Amos Jeffries

Markus Moeller wrote:


"Kinkie"  wrote in message 
news:aanlktikt2zra7o+s8zrjj2abs==jbiw3dl8xtxnrb...@mail.gmail.com...

Hi all,
 Kerberos integration in squidclient has caused some problems with 
squidclient;


Ubuntu 10.4 fails with
/home/kinkie/squid/workspace/stringng/tools/squidclient.cc:857:
undefined reference to `gss_release_buffer'
/home/kinkie/squid/workspace/stringng/tools/squidclient.cc:850:
undefined reference to `gss_display_status'
/home/kinkie/squid/workspace/stringng/tools/squidclient.cc:854:
undefined reference to `gss_release_buffer'



What does configure say about HAVE_GSSAPI ?  Can I see the config.log ?


I see you have a proposed patch already.


For future reference by everybody:

 Any of the emails here titled "Build failed in Hudson: ..." details 
the build daemon output.


 The files from latest build attempt can be found (read-only) in the 
hudson job workspace. In this case:

  http://build.squid-cache.org/job/3.HEAD-i386-opensolaris/ws/


Amos
--
Please be using
  Current Stable Squid 2.7.STABLE9 or 3.1.7
  Beta testers wanted for 3.2.0.1


[RFC] origin peer type

2010-08-28 Thread Amos Jeffries
Right now we have siblings, parents, and multicast peers with their own 
types. By origin servers require both parent and origin flags to be set.


I propose adding a peer type of "origin". Collapsing the parent type + 
originserver flag(s) into one peer type and making it a clear 
distinction between upstream proxies and origins.


Thoughts?

Does anyone know of a case where originserver flags is valid on sibling 
or multicast peer relationsips?


Amos
--
Please be using
  Current Stable Squid 2.7.STABLE9 or 3.1.7
  Beta testers wanted for 3.2.0.1


Re: Squidclient doesn't build in head

2010-08-28 Thread Markus Moeller
"Kinkie"  wrote in message 
news:aanlktikt2zra7o+s8zrjj2abs==jbiw3dl8xtxnrb...@mail.gmail.com...

Hi all,
 Kerberos integration in squidclient has caused some problems with 
squidclient;


Ubuntu 10.4 fails with
/home/kinkie/squid/workspace/stringng/tools/squidclient.cc:857:
undefined reference to `gss_release_buffer'
/home/kinkie/squid/workspace/stringng/tools/squidclient.cc:850:
undefined reference to `gss_display_status'
/home/kinkie/squid/workspace/stringng/tools/squidclient.cc:854:
undefined reference to `gss_release_buffer'

Opensolaris instead complains that
../../tools/squidclient.cc: In function `char* GSSAPI_token(const char*)':
../../tools/squidclient.cc:912: error: `gss_nt_service_name'
undeclared (first use this function)


I couldn't find a simple way to fix this.. any hints?



Does this fix it ?


# bzr diff -r submit:
Using parent branch http://bzr.squid-cache.org/bzr/squid3/trunk/
=== modified file 'tools/squidclient.cc'
--- tools/squidclient.cc2010-08-25 03:10:45 +
+++ tools/squidclient.cc2010-08-28 12:42:07 +
@@ -80,43 +80,23 @@
#endif

#if HAVE_GSSAPI
-#ifdef HAVE_HEIMDAL_KERBEROS
-#ifdef HAVE_GSSAPI_GSSAPI_H
-#include 
-#elif defined(HAVE_GSSAPI_H)
-#include 
-#else
-#error "GSSAPI header required"
-#endif
-#define gss_nt_service_name GSS_C_NT_HOSTBASED_SERVICE
-#else
-#ifdef HAVE_SEAM_KERBEROS
-#ifdef HAVE_GSSAPI_GSSAPI_H
-#include 
-#elif defined(HAVE_GSSAPI_H)
-#include 
-#else
-#error "GSSAPI header required"
-#endif
-#ifdef HAVE_GSSAPI_GSSAPI_EXT_H
+#if HAVE_GSSAPI_GSSAPI_H
+#include 
+#elif HAVE_GSSAPI_H
+#include 
+#endif  /* HAVE_GSSAPI_H */
+#if HAVE_GSSAPI_GSSAPI_EXT_H
#include 
-#endif
-#define gss_nt_service_name GSS_C_NT_HOSTBASED_SERVICE
-#else /*MIT */
-#ifdef HAVE_GSSAPI_GSSAPI_H
-#include 
-#elif defined(HAVE_GSSAPI_H)
-#include 
-#else
-#error "GSSAPI header required"
-#endif
-#ifdef HAVE_GSSAPI_GSSAPI_KRB5_H
+#endif  /* HAVE_GSSAPI_GSSAPI_EXT_H */
+#if HAVE_GSSAPI_GSSAPI_KRB5_H
#include 
-#endif
-#ifdef HAVE_GSSAPI_GSSAPI_GENERIC_H
+#endif  /* HAVE_GSSAPI_GSSAPI_KRB5_H */
+#if HAVE_GSSAPI_GSSAPI_GENERIC_H
#include 
-#endif
-#endif
+#endif  /* HAVE_GSSAPI_GSSAPI_GENERIC_H */
+
+#ifndef gss_nt_service_name
+#define gss_nt_service_name GSS_C_NT_HOSTBASED_SERVICE
#endif

#ifndef gss_mech_spnego




Thanks


--
/kinkie



Markus 





Re: Squidclient doesn't build in head

2010-08-28 Thread Markus Moeller


"Kinkie"  wrote in message 
news:aanlktikt2zra7o+s8zrjj2abs==jbiw3dl8xtxnrb...@mail.gmail.com...

Hi all,
 Kerberos integration in squidclient has caused some problems with 
squidclient;


Ubuntu 10.4 fails with
/home/kinkie/squid/workspace/stringng/tools/squidclient.cc:857:
undefined reference to `gss_release_buffer'
/home/kinkie/squid/workspace/stringng/tools/squidclient.cc:850:
undefined reference to `gss_display_status'
/home/kinkie/squid/workspace/stringng/tools/squidclient.cc:854:
undefined reference to `gss_release_buffer'



What does configure say about HAVE_GSSAPI ?  Can I see the config.log ?


Opensolaris instead complains that
../../tools/squidclient.cc: In function `char* GSSAPI_token(const char*)':
../../tools/squidclient.cc:912: error: `gss_nt_service_name'
undeclared (first use this function)




I will check this.


I couldn't find a simple way to fix this.. any hints?

Thanks


--
/kinkie



Markus 





Build failed in Hudson: 3.HEAD-i386-opensolaris #432

2010-08-28 Thread noc
See 

Changes:

[Amos Jeffries ] Author: Stefan Fritsch 
Bug 2872: leaking file descriptors

As I understand it, the leak happens this way: A client request kicks off an
asynchronous file open request. If the client request is aborted and disappears
before the file open has completed, the file is never closed again. This
explains why this leak can only happen with aufs and not with ufs.

[Amos Jeffries ] Move &>bs logformat code release 
notes to 3.2

--
[...truncated 4544 lines...]
libtool: link: ccache g++ -Wall -Wpointer-arith -Wwrite-strings -Wcomments 
-Werror -pipe -D_REENTRANT -g -O2 -o basic_nis_auth basic_nis_auth.o 
nis_support.o  -L/usr/local/gcc-libs/lib 
-L
 -lmiscutil ../../../compat/.libs/libcompat.a /usr/sfw/lib/libstdc++.so 
-L/usr/sfw/lib -lgcc_s -lcrypt -lmd5 -lm -lmalloc -lsocket -lresolv -lnsl 
-Wl,-R -Wl,/usr/sfw/lib -Wl,-R -Wl,/usr/sfw/lib
ld: warning: file /usr/sfw/lib/libstdc++.so: attempted multiple inclusion of 
file
make[4]: Leaving directory 
`
Making all in PAM
make[4]: Entering directory 
`
ccache g++ -DHAVE_CONFIG_H  -I../../../.. -I../../../../include 
-I../../../../src -I../../../include -I/usr/local/include -I/usr/include/gssapi 
-I/usr/include/kerberosv5 -I../../../../libltdl  -I/usr/include/gssapi 
-I/usr/include/kerberosv5 -Wall -Wpointer-arith -Wwrite-strings -Wcomments 
-Werror -pipe -D_REENTRANT -g -O2 -MT basic_pam_auth.o -MD -MP -MF 
.deps/basic_pam_auth.Tpo -c -o basic_pam_auth.o 
../../../../helpers/basic_auth/PAM/basic_pam_auth.cc
mv -f .deps/basic_pam_auth.Tpo .deps/basic_pam_auth.Po
/bin/sh ../../../libtool --tag=CXX   --mode=link ccache g++ -Wall 
-Wpointer-arith -Wwrite-strings -Wcomments -Werror -pipe -D_REENTRANT -g -O2  
-L/usr/local/gcc-libs/lib -o basic_pam_auth basic_pam_auth.o -L../../../lib 
-lmiscutil ../../../compat/libcompat.la -lpam -lm -lmalloc -lsocket -lresolv 
-lnsl 
libtool: link: ccache g++ -Wall -Wpointer-arith -Wwrite-strings -Wcomments 
-Werror -pipe -D_REENTRANT -g -O2 -o basic_pam_auth basic_pam_auth.o  
-L/usr/local/gcc-libs/lib 
-L
 -lmiscutil ../../../compat/.libs/libcompat.a /usr/sfw/lib/libstdc++.so 
-L/usr/sfw/lib -lgcc_s -lpam -lm -lmalloc -lsocket -lresolv -lnsl -Wl,-R 
-Wl,/usr/sfw/lib -Wl,-R -Wl,/usr/sfw/lib
ld: warning: file /usr/sfw/lib/libstdc++.so: attempted multiple inclusion of 
file
make[4]: Leaving directory 
`
Making all in POP3
make[4]: Entering directory 
`
sed -e 's,[...@]perl[@],/usr/bin/perl,g' 
<../../../../helpers/basic_auth/POP3/basic_pop3_auth.pl.in >basic_pop3_auth || 
(/usr/gnu/bin/rm -f -f basic_pop3_auth ; exit 1)
make[4]: Leaving directory 
`
Making all in RADIUS
make[4]: Entering directory 
`
ccache g++ -DHAVE_CONFIG_H  -I../../../.. -I../../../../include 
-I../../../../src -I../../../include -I/usr/local/include -I/usr/include/gssapi 
-I/usr/include/kerberosv5 -I../../../../libltdl 
-I../../../../helpers/basic_auth/RADIUS  -I/usr/include/gssapi 
-I/usr/include/kerberosv5 -Wall -Wpointer-arith -Wwrite-strings -Wcomments 
-Werror -pipe -D_REENTRANT -g -O2 -MT basic_radius_auth.o -MD -MP -MF 
.deps/basic_radius_auth.Tpo -c -o basic_radius_auth.o 
../../../../helpers/basic_auth/RADIUS/basic_radius_auth.cc
ccache g++ -DHAVE_CONFIG_H  -I../../../.. -I../../../../include 
-I../../../../src -I../../../include -I/usr/local/include -I/usr/include/gssapi 
-I/usr/include/kerberosv5 -I../../../../libltdl 
-I../../../../helpers/basic_auth/RADIUS  -I/usr/include/gssapi 
-I/usr/include/kerberosv5 -Wall -Wpointer-arith -Wwrite-strings -Wcomments 
-Werror -pipe -D_REENTRANT -g -O2 -MT radius-util.o -MD -MP -MF 
.deps/radius-util.Tpo -c -o radius-util.o 
../../../../helpers/basic_auth/RADIUS/radius-util.cc
mv -f .deps/radius-util.Tpo .deps/radius-util.Po
mv -f .deps/basic_radius_auth.Tpo .deps/basic_radius_auth.Po
/bin/sh ../../../libtool --tag=CXX   --mode=link ccache g++ -Wall 
-Wpointer-arith -Wwrite-strings -Wcomments -Werror -pipe -D_RE