Re: svn commit: r691418 [2/2] - in /httpd/httpd/trunk: ./ docs/manual/mod/ modules/filters/
On Tue, Sep 09, 2008 at 10:19:47PM -0700, Basant Kukreja wrote: > > > > What are the above constants supposed to be. Opening the file in vi shows > > that they are special > > characters or better control characters. Looking with a hex editor these > > () seem to be \\08. > > Is this correct? > > Sed has a "l" command. From the sed man page : > (2)lList the pattern space on the standard out- > put in an unambiguous form. Non-printing > characters are spelled in two digit ASCII > and long lines are folded. > > From the code : >p3 = trans[(unsigned char)*p1-1]; > while ((*p2++ = *p3++) != 0) > if(p2 >= eval->lcomend) { > *p2 = '\\'; > wline(eval, eval->genbuf, strlen(eval->genbuf)); > p2 = eval->genbuf; > } > > > It looks to me that it is trying to print character from value 0 to 31 as > printable characters. > > >> +"-<", > >> +"->", > It seems to me that it should be \\08 and \\09. > > I will dig deeper to see if these can be simplified. It looks little weird > that > there are binary characters in source file. > > Regards, > Basant. > I investigated further. I wrote a test file having binary character from 0 to 31: $ od -c out.txt 000 \0 \n 001 \n 002 \n 003 \n 004 \n 005 \n 006 \n 007 \n 020 \b \n \t \n \n \n 013 \n \f \n \r \n 016 \n 017 \n ... And a small sed script : $ cat one.sed l d Sed script just runs the "l" command for each line. $ /usr/ucb/sed -f one.sed out.txt > out1.txt Here is the output of out1.txt $ od -c out1.txt 000 \n \ 0 1 \n \ 0 2 \n \ 0 3 \n \ 0 4 020 \n \ 0 5 \n \ 0 6 \n \ 0 7 \n - \b < 040 \n - \b > \n \n \n \ 1 3 \n \ 1 4 \n \ 060 1 5 \n \ 1 6 \n \ 1 7 \n \ 2 0 \n \ ... $ cat out1.txt \01 \02 \03 \04 \05 \06 \07 < > \13 \14 --- So for some strange reason : 0x8 is converted to "-\b<" and 0x9 is converted to "-\b>" That's what we see in "trans" variable. Do you think it could be a bug in original sed and should we correct it? It should probably print "\10" and "\11". BTW /usr/bin/sed have the exactly the same behavior. It sound strange though that this was never caught in sed code. Regards, Basant. Note : GNU sed (gsed) have a different behavior. GNU sed changes it to "\b$" and "\t$". $ sed -f one.sed out.txt \000$ \001$ \002$ \003$ \004$ \005$ \006$ \a$ \b$ \t$ $ $ \v$ \f$ \r$ \016$ \017$ \020$
Re: svn commit: r691418 [2/2] - in /httpd/httpd/trunk: ./ docs/manual/mod/ modules/filters/
On Tue, Sep 09, 2008 at 10:10:42PM +0200, Ruediger Pluem wrote: > > > On 09/03/2008 01:01 AM, [EMAIL PROTECTED] wrote: >> Added: httpd/httpd/trunk/modules/filters/sed1.c >> URL: >> http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/filters/sed1.c?rev=691418&view=auto >> == >> --- httpd/httpd/trunk/modules/filters/sed1.c (added) >> +++ httpd/httpd/trunk/modules/filters/sed1.c Tue Sep 2 16:01:47 2008 >> @@ -0,0 +1,957 @@ >> +/* >> + * Copyright (c) 2005, 2008 Sun Microsystems, Inc. All Rights Reserved. >> + * Use is subject to license terms. >> + * >> + * Copyright (c) 1984 AT&T >> + *All Rights Reserved >> + * >> + * Licensed under the Apache License, Version 2.0 (the "License"); >> + * you may not use this file except in compliance with the License. >> + * You may obtain a copy of the License at >> + * http://www.apache.org/licenses/LICENSE-2.0. + * + * Unless >> required by applicable law or agreed to in writing, software + * >> distributed under the License is distributed on an "AS IS" BASIS, + * >> WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or >> implied. + * See the License for the specific language governing >> permissions and >> + * limitations under the License. + */ >> + >> +#include "apr.h" >> +#include "apr_lib.h" >> +#include "libsed.h" >> +#include "sed.h" >> +#include "apr_strings.h" >> +#include "regexp.h" >> + >> +char*trans[040] = { >> +"\\01", >> +"\\02", >> +"\\03", >> +"\\04", >> +"\\05", >> +"\\06", >> +"\\07", >> +"-<", >> +"->", > > What are the above constants supposed to be. Opening the file in vi shows > that they are special > characters or better control characters. Looking with a hex editor these () > seem to be \\08. > Is this correct? Sed has a "l" command. From the sed man page : (2)lList the pattern space on the standard out- put in an unambiguous form. Non-printing characters are spelled in two digit ASCII and long lines are folded. >From the code : p3 = trans[(unsigned char)*p1-1]; while ((*p2++ = *p3++) != 0) if(p2 >= eval->lcomend) { *p2 = '\\'; wline(eval, eval->genbuf, strlen(eval->genbuf)); p2 = eval->genbuf; } It looks to me that it is trying to print character from value 0 to 31 as printable characters. >> +"-<", >> +"->", It seems to me that it should be \\08 and \\09. I will dig deeper to see if these can be simplified. It looks little weird that there are binary characters in source file. Regards, Basant.
Re: svn commit: r691418 [2/2] - in /httpd/httpd/trunk: ./ docs/manual/mod/ modules/filters/
On Sep 9, 2008, at 1:38 PM, Ruediger Pluem wrote: IMHO the following patch should fix the mod_mbox error by correctly encoding these chars: Index: module-2.0/mod_mbox_cte.c === --- module-2.0/mod_mbox_cte.c (Revision 693585) +++ module-2.0/mod_mbox_cte.c (Arbeitskopie) @@ -91,6 +91,9 @@ else if (s[i] == '&') { j += 4; } +else if (((unsigned char) s[i]) < 32) { +j += 5; +} } /* If there is nothing to escape, just copy the body to the new @@ -118,6 +121,10 @@ memcpy(&x[j], "&", 5); j += 4; } +else if (((unsigned char) s[i]) < 32) { +apr_snprintf(&x[j], 6, "%02i;", s[i]); +j += 4; +} else { x[j] = s[i]; } Um, this won't make the XML problems go away, because some of those "control chars" < 32 are simply illegal in an XML document, see http://www.w3.org/TR/REC-xml/#NT-Char - this code could produce, for example, which is just not allowed. I don't know what the constraints are, but it does seem odd to put "characters" like ASCII ENQ or SO, which have no shared semantics by anything, in something you might send over the Internet. -Tim
Re: svn commit: r691418 [2/2] - in /httpd/httpd/trunk: ./ docs/manual/mod/ modules/filters/
On 09/09/2008 10:10 PM, Ruediger Pluem wrote: On 09/03/2008 01:01 AM, [EMAIL PROTECTED] wrote: Added: httpd/httpd/trunk/modules/filters/sed1.c URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/filters/sed1.c?rev=691418&view=auto == --- httpd/httpd/trunk/modules/filters/sed1.c (added) +++ httpd/httpd/trunk/modules/filters/sed1.c Tue Sep 2 16:01:47 2008 @@ -0,0 +1,957 @@ +/* + * Copyright (c) 2005, 2008 Sun Microsystems, Inc. All Rights Reserved. + * Use is subject to license terms. + * + *Copyright (c) 1984 AT&T + * All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0. + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "apr.h" +#include "apr_lib.h" +#include "libsed.h" +#include "sed.h" +#include "apr_strings.h" +#include "regexp.h" + +char*trans[040] = { +"\\01", +"\\02", +"\\03", +"\\04", +"\\05", +"\\06", +"\\07", +"-<", +"->", What are the above constants supposed to be. Opening the file in vi shows that they are special characters or better control characters. Looking with a hex editor these () seem to be \\08. Is this correct? BTW: I noticed it because this commit message broke the atom feed of mod_box for the cvs list as these characters make the xml document of the feed invalid. But I guess this is an error in mod_mbox. IMHO the following patch should fix the mod_mbox error by correctly encoding these chars: Index: module-2.0/mod_mbox_cte.c === --- module-2.0/mod_mbox_cte.c (Revision 693585) +++ module-2.0/mod_mbox_cte.c (Arbeitskopie) @@ -91,6 +91,9 @@ else if (s[i] == '&') { j += 4; } +else if (((unsigned char) s[i]) < 32) { +j += 5; +} } /* If there is nothing to escape, just copy the body to the new @@ -118,6 +121,10 @@ memcpy(&x[j], "&", 5); j += 4; } +else if (((unsigned char) s[i]) < 32) { +apr_snprintf(&x[j], 6, "%02i;", s[i]); +j += 4; +} else { x[j] = s[i]; } As I have no environment where I can test mod_mbox can someone please check this patch? Regards RĂ¼diger
Re: svn commit: r691418 [2/2] - in /httpd/httpd/trunk: ./ docs/manual/mod/ modules/filters/
On 09/03/2008 01:01 AM, [EMAIL PROTECTED] wrote: Added: httpd/httpd/trunk/modules/filters/sed1.c URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/filters/sed1.c?rev=691418&view=auto == --- httpd/httpd/trunk/modules/filters/sed1.c (added) +++ httpd/httpd/trunk/modules/filters/sed1.c Tue Sep 2 16:01:47 2008 @@ -0,0 +1,957 @@ +/* + * Copyright (c) 2005, 2008 Sun Microsystems, Inc. All Rights Reserved. + * Use is subject to license terms. + * + * Copyright (c) 1984 AT&T + * All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0. + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "apr.h" +#include "apr_lib.h" +#include "libsed.h" +#include "sed.h" +#include "apr_strings.h" +#include "regexp.h" + +char*trans[040] = { +"\\01", +"\\02", +"\\03", +"\\04", +"\\05", +"\\06", +"\\07", +"-<", +"->", What are the above constants supposed to be. Opening the file in vi shows that they are special characters or better control characters. Looking with a hex editor these () seem to be \\08. Is this correct? BTW: I noticed it because this commit message broke the atom feed of mod_box for the cvs list as these characters make the xml document of the feed invalid. But I guess this is an error in mod_mbox. Regards RĂ¼diger
Re: mod_status slots
Jordi Prats wrote: How can I test that? I've repeated this test succesfully like this: That looks great, thanks for confirming!
Re: mod_status slots
How can I test that? I've repeated this test succesfully like this: first shell: I perform continuous ab test like this: while true; do /usr/local/apache2/bin/ab -c 14 -n 5000 http://127.0.0.1/server-status; done second shell: I store the ScoreBoard to a file: while true; do wget http://10.12.80.1/server-status?auto -O - 2>/dev/null| grep Scoreboard >> /tmp/foo; done third shell: I do a graceful with two echos (before and after) using this command: echo "before graceful" >> /tmp/foo; /usr/local/apache2/bin/apachectl graceful; echo "after graceful" >> /tmp/foo; Then, on /tmp/foo you can find something like this: Scoreboard: WWCWCCC Scoreboard: _CC_CCCWCCC Scoreboard: _CCWCCC Scoreboard: WCC_C_CCC_C Scoreboard: CCW Scoreboard: C_CCW__ Scoreboard: CWC Scoreboard: CCCW_CC Scoreboard: __CCC_CCWCC Scoreboard: CCCWC__ Scoreboard: CCW__C_CCC__WC_ Scoreboard: C_CC_CCCWCC Scoreboard: CC__C_CCCWC Scoreboard: WCC before graceful Scoreboard: ___CW_CW__C Scoreboard: __WCCRCC_CC Scoreboard: __CCC_C_C_CWCCC Scoreboard: CC_CCCWCCC_ Scoreboard: CC__CWCCWCC after graceful Scoreboard: WGGCC Scoreboard: RCCWC Scoreboard: WCCWC Scoreboard: WWCCC Scoreboard: CCWCW Scoreboard: CWCCC Scoreboard: CCCWC Scoreboard: CCCWW Scoreboard: CWCCC On Mon, Sep 8, 2008 at 6:00 PM, William A. Rowe, Jr. <[EMAIL PROTECTED]> wrote: > Jordi Prats wrote: >> >> Hi all, >> There's any way to formally propose this littler change to mod_status? >> >> Jordi >> >> On Mon, Aug 11, 2008 at 9:57 AM, Jordi Prats <[EMAIL PROTECTED]> >> wrote: >>> >>> On Fri, Aug 8, 2008 at 7:04 PM, William A. Rowe, Jr. >>> <[EMAIL PROTECTED]> wrote: Jordi Prats wrote: > > I don't know about other implications of changing this line. I've just > tested it using prefork both restarting and reloading apache. What do > you think about this little change? How's your proposed patch interact with a server using slots 1-16, 128-136 when they gracefully restart the server with a lower number of maxclients? >>> It works fine. For example: >>> >>> Using: >>> >>> MaxClients 15 >>> ServerLimit 15 >>> >>> Using ab like this: >>> >>> while true; do /usr/local/apache2/bin/ab -c 14 -n 5000 >>> http://127.0.0.1/server-status; done >>> >>> I get: >>> >>> slots: 15 CWC >>> >>> Then I gracefully restart apache using: >>> >>> MaxClients 5 >>> ServerLimit 15 >>> >>> Then I get: >>> >>> slots: 5 WWCCR > > I'm asking, if those workers are spread across clients. I'm not altogether > clear if those were reaped, or if they just happened to line up. > -- Jordi