httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Basant Kukreja <Basant.Kukr...@Sun.COM>
Subject Re: svn commit: r691418 [2/2] - in /httpd/httpd/trunk:./docs/manual/mod/ modules/filters/
Date Wed, 10 Sep 2008 13:54:12 GMT
On Wed, Sep 10, 2008 at 03:41:21PM +0200, "Plüm, Rüdiger, VF-Group" wrote:
>  
> 
> > -----Ursprüngliche Nachricht-----
> > Von: Basant.Kukreja@Sun.COM 
> > Gesendet: Mittwoch, 10. September 2008 15:32
> > An: dev@httpd.apache.org
> > Betreff: Re: svn commit: r691418 [2/2] - in 
> > /httpd/httpd/trunk:./docs/manual/mod/ modules/filters/
> > 
> > On Wed, Sep 10, 2008 at 10:10:20AM +0200, "Plüm, Rüdiger, 
> > VF-Group" wrote:
> > >  
> > > 
> > > > -----Ursprüngliche Nachricht-----
> > > > Von: Basant.Kukreja@Sun.COM 
> > > > Gesendet: Mittwoch, 10. September 2008 08:56
> > > > An: dev@httpd.apache.org
> > > > Betreff: Re: svn commit: r691418 [2/2] - in 
> > > > /httpd/httpd/trunk: ./docs/manual/mod/ modules/filters/
> > > > 
> > > 
> > > > I investigated further. I wrote a test file having binary 
> > > > character from 0 to 31:
> > > > $ od -c out.txt
> > > > 0000000  \0  \n 001  \n 002  \n 003  \n 004  \n 005  \n 006  
> > > > \n 007  \n
> > > > 0000020  \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
> > > > 0000000  \n   \   0   1  \n   \   0   2  \n   \   0   3  \n   
> > > > \   0   4
> > > > 0000020  \n   \   0   5  \n   \   0   6  \n   \   0   7  \n   
> > > > -  \b   <
> > > > 0000040  \n   -  \b   >  \n  \n  \n   \   1   3  \n   \   1   
> > > > 4  \n   \
> > > > 0000060   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? 
> > > 
> > > I guess it is a bug in original sed and it should be corrected.
> > > IMHO it should be suffient to replace
> > > 
> > > -\b<
> > > 
> > > and
> > > 
> > > -\b<
> > > 
> > > with
> > > 
> > > <
> > > 
> > > and
> > > 
> > > >
> > Can you elaborate why you chose "<" and ">". I could not think of any
> > reasons behind it.
> 
> Because these characters are currently displayed by sed and I saw no reason to change
> it.
> 
> > sed's man page says :
> >     (2)l            List 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.
> > 
> > So 0x8 and 0x9 char values, which I believe are non printable 
> > characters,
> > should be printed into *two* digit ASCII. So \10 and \11 looks to me
> > as conforming to man page.
> 
> As said displaying two digit ASCII's also makes sense and conforms to the man
> page. So go for it.
> BTW: Shouldn't it be \08 and \09 for 0x8 and 0x9 instead of \10 and \11 ?
If we notice, how other characters are printed then sed code is using octal
numbers. After \17 it changes to \20, \21. Similarly After \27 it changes to
\30, \31 etc. So based on the above pattern, \10 and \11 seems to be more
consistent to me.

For reference, output of the converted characters (0-31) by "l" command is
given below.

$ cat out1.txt

\01
\02
\03
\04
\05
\06
\07
<
>


\13
\14
\15
\16
\17
\20
\21
\22
\23
\24
\25
\26
\27
\30
\31
\32
\33
\34
\35
\36
\37

I will submit the patch today. Thanks for noticing this.

Regards,
Basant.

Mime
View raw message