You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Jeff Trawick <tr...@bellsouth.net> on 2000/12/28 22:06:48 UTC

Re: cvs commit: httpd-2.0/build build.mk config-stubs

rbb@locus.apache.org writes:

> rbb         00/12/26 14:48:49
> 
>   Modified:    build    build.mk config-stubs
>   Log:
>   Finish up the config.m4 file overhaul, so that we can load config.m4 files
>   in order.
...
>   Index: config-stubs
>   ===================================================================
>   RCS file: /home/cvs/httpd-2.0/build/config-stubs,v
>   retrieving revision 1.1
>   retrieving revision 1.2
>   diff -u -r1.1 -r1.2
>   --- config-stubs	1999/11/29 23:45:32	1.1
>   +++ config-stubs	2000/12/26 22:48:49	1.2
>   @@ -1,8 +1,10 @@
>    #!/bin/sh
>    
>   -dir=$1
>   -for stubdir in `find $dir -type d`; do
>   -    if [ -r $stubdir/config.m4 ]; then
>   -        echo "sinclude($stubdir/config.m4)"
>   +for configfiles in `find . -name "config*.m4" | \
>   +         sed 's#\(.*\)\/config\(.*\)\.m4#\2config.m4\1#' | \
>   +         sort -g | \
>   +         sed 's#\(.*\)config.m4\(.*\)#\2/config\1.m4#g'`; do
>   +    if [ -r $configfiles ]; then
>   +        echo "sinclude($configfiles)"

What does "sort -g" do?  GNU sort man page doesn't describe "-g" and
OS/390 sort doesn't accept "-g".

-- 
Jeff Trawick | trawickj@bellsouth.net | PGP public key at web site:
       http://www.geocities.com/SiliconValley/Park/9289/
             Born in Roswell... married an alien...

Re: cvs commit: httpd-2.0/build build.mk config-stubs

Posted by Greg Stein <gs...@lyra.org>.
On Sat, Dec 30, 2000 at 03:02:38PM -0800, rbb@covalent.net wrote:
> 
> > > Small problem with that.  It forces us to use config0.m4 for the basic
> > > config.m4 files, i.e. those which should be first.  That is one of the
> > > things I was trying to avoid doing.
> > 
> > config.m4 sorts before config##.m4  ... ord('.') < ord('0')
> > 
> > We don't need to put any switches on the sort, which should help with
> > portability.
> 
> take a look at the script again please.  We can't just sort on config*.m4,
> because the path gets in the way.  We also don't know how many elements
> are in the path, so we can't just use -k to specify a specific path
> element.  For that reason, we re-arrange the path elements to be:
> 
> config*.m4/path/to/file
> 
> Then we sort, and then we re-order it back.  Because of that, we can't
> just use sort.  However, sort -n -b works just fine.

I mean "plain sort [with the path rearrangement]". I figured this out
back in July... I know the path gets in the way.

The point is that -n -b is superfluous, so they can be axed to ensure that
we don't hit any portability issues.

-g

-- 
Greg Stein, http://www.lyra.org/

Re: cvs commit: httpd-2.0/build build.mk config-stubs

Posted by Greg Stein <gs...@lyra.org>.
On Sat, Dec 30, 2000 at 11:15:40PM -0600, James G Smith wrote:
> Greg Stein <gs...@lyra.org> wrote:
> >On Sat, Dec 30, 2000 at 04:42:41PM -0800, rbb@covalent.net wrote:
>...
> >> config5.m4./modules/generators
> >> config.m4./modules/aaa
> 
> hmm... If I create a file with the above two names (with no 
> leading whitespace), and sort them, I get them with config.m4 
> first:
> 
> # sort t
> config.m4./modules/aaa
> config5.m4./modules/generators

What happens when you use "sort -n" on the above two lines?

Cheers,
-g

-- 
Greg Stein, http://www.lyra.org/

Re: cvs commit: httpd-2.0/build build.mk config-stubs

Posted by Greg Stein <gs...@lyra.org>.
On Sat, Dec 30, 2000 at 08:52:53PM -0800, rbb@covalent.net wrote:
>...
> Currently, we are only relying on flags that are specified by single unix,
> and it definately works.

It works on platforms with a "sort" that happens to match single unix (what
happens on OS/2 or VMS or TPF or...). It is much safer to avoid relying on
that, if possible. It already appears that OpenBSD defines sort a bit
differently than my linux box. (OpenBSD says config.m4 < config5.m4 while
Linux says config5.m4 < config.m4)

> I have a feeling that this model will require
> zero padding, which I thoroughly dislike.

No zero padding unless we decide to allow more than config1 ... config9
levels of granularity. If we want to define 01..99 (which I would
recommend), then the first ten levels would be config01..config09.
"config.m4" always sorts as you defined: before any config file with a
number.

> What problem do you have with the current setup?

Tweakiness with different platforms' sort program.

My main thing was simplifying the sed expressions, which I've done and
checked in. The numeric thing is secondary, but still helpful to avoid if we
can.

Cheers,
-g

-- 
Greg Stein, http://www.lyra.org/

Re: cvs commit: httpd-2.0/build build.mk config-stubs

Posted by rb...@covalent.net.
> Oh bother. sort uses alpha/whitespace transitions rather than pure string
> comparisons (config5.m4 sorts after config.m4 on a string basis). You *are*
> right that we want config.m4 to be before config5.m4.
> 
> Okay. Here is the command line that I was thinking of:
> 
>   find . -name "config*.m4" | \
>     sed 's#\(.*/\(config[0-9]*\).m4\)$#\200 \1#' | \
>     sort | \
>     sed 's#.* ##'
> 
> The first sed produces lines like:
> 
> config00 ./server/mpm/spmt_os2/config.m4
> config0500 ./modules/aaa/config05.m4
> 
> In other words, we make config.m4 act as config00.m4 (for config's with
> numbers, the extra 00 doesn't bother them).
> 
> Note that we'd want to decide on 1 or 2 digits. Will we ever need two?
> 
> In any case... the above cmd line doesn't require extra flags from sort
> (thus, the most portable) and the sed lines are simpler. My CVS is screwed
> right now (dev.apache.org points to the wrong place), but I can patch it in
> when the weekend reorg is fixed.

Currently, we are only relying on flags that are specified by single unix,
and it definately works.  I have a feeling that this model will require
zero padding, which I thoroughly dislike.

What problem do you have with the current setup?

Ryan

_______________________________________________________________________________
Ryan Bloom                        	rbb@apache.org
406 29th St.
San Francisco, CA 94131
-------------------------------------------------------------------------------


Re: cvs commit: httpd-2.0/build build.mk config-stubs

Posted by Greg Stein <gs...@lyra.org>.
On Sat, Dec 30, 2000 at 04:42:41PM -0800, rbb@covalent.net wrote:
>...
> That doesn't work.  I have just done the following on my machine:
> 
> 	 find . -name "config*.m4" | \
>          sed 's#\(.*\)\/\(config.*\.m4\)#\2\1#' | \
>          sort
> 
> Which finds all of the config*.m4 files, and changes the line to
> config*.m4/path/to/file, and the sorts the files, and I got the following:
> 
> config5.m4./modules/generators
> config.m4./modules/aaa

Oh bother. sort uses alpha/whitespace transitions rather than pure string
comparisons (config5.m4 sorts after config.m4 on a string basis). You *are*
right that we want config.m4 to be before config5.m4.

Okay. Here is the command line that I was thinking of:

  find . -name "config*.m4" | \
    sed 's#\(.*/\(config[0-9]*\).m4\)$#\200 \1#' | \
    sort | \
    sed 's#.* ##'

The first sed produces lines like:

config00 ./server/mpm/spmt_os2/config.m4
config0500 ./modules/aaa/config05.m4

In other words, we make config.m4 act as config00.m4 (for config's with
numbers, the extra 00 doesn't bother them).

Note that we'd want to decide on 1 or 2 digits. Will we ever need two?

In any case... the above cmd line doesn't require extra flags from sort
(thus, the most portable) and the sed lines are simpler. My CVS is screwed
right now (dev.apache.org points to the wrong place), but I can patch it in
when the weekend reorg is fixed.

Cheers,
-g

-- 
Greg Stein, http://www.lyra.org/

Re: cvs commit: httpd-2.0/build build.mk config-stubs

Posted by rb...@covalent.net.
> > *config.m4./path/to/file.
> > 
> > Obviosuly, every number is < c, so we can't just use sort.  I did put the
> > number first to avoid having to zero-pad, and we can use -n -b, so what we
> > have works just fine.
> 
> It is easier to revise them to:
> 
> config*.m4<sp>/path/to/config*.m4
> 
> That simplifies both sed scripts *and* avoids switches to the sort program.
> 
> [ I used awk in my original, but your choice of sed is better ]

That doesn't work.  I have just done the following on my machine:

	 find . -name "config*.m4" | \
         sed 's#\(.*\)\/\(config.*\.m4\)#\2\1#' | \
         sort

Which finds all of the config*.m4 files, and changes the line to
config*.m4/path/to/file, and the sorts the files, and I got the following:

config5.m4./modules/generators
config.m4./modules/aaa
config.m4./modules/cache
config.m4./modules/dav/fs
config.m4./modules/dav/main
config.m4./modules/echo
config.m4./modules/experimental
config.m4./modules/filters
config.m4./modules/http
config.m4./modules/loggers
config.m4./modules/mappers
config.m4./modules/metadata
config.m4./modules/proxy
config.m4./os
config.m4./os/beos
config.m4./os/os2
config.m4./os/unix
config.m4./server
config.m4./server/mpm
config.m4./server/mpm/beos
config.m4./server/mpm/dexter
config.m4./server/mpm/mpmt_beos
config.m4./server/mpm/mpmt_pthread
config.m4./server/mpm/perchild
config.m4./server/mpm/prefork
config.m4./server/mpm/spmt_os2


Notice that the config5.m4 file is at the top, instead of at the bottom
where it belongs.  This means that we would need to pad each file with at
least one 0 to get a valid sort.  That is bad in my opinion.  I suggest
that we leave everything as it is now, because we get the correct order,
and we are only using arguments to sort that are specified by single unix.

Ryan

_______________________________________________________________________________
Ryan Bloom                        	rbb@apache.org
406 29th St.
San Francisco, CA 94131
-------------------------------------------------------------------------------


Re: cvs commit: httpd-2.0/build build.mk config-stubs

Posted by Greg Stein <gs...@lyra.org>.
On Sat, Dec 30, 2000 at 03:11:11PM -0800, rbb@covalent.net wrote:
>...
> I'm sorry, that makes little to no sense, because we are sorting based on
> config*.m4.  My fault.  The problem is that we actually re-order the files
> to:
> 
> *config.m4./path/to/file.
> 
> Obviosuly, every number is < c, so we can't just use sort.  I did put the
> number first to avoid having to zero-pad, and we can use -n -b, so what we
> have works just fine.

It is easier to revise them to:

config*.m4<sp>/path/to/config*.m4

That simplifies both sed scripts *and* avoids switches to the sort program.

[ I used awk in my original, but your choice of sed is better ]

Cheers,
-g

-- 
Greg Stein, http://www.lyra.org/

Re: cvs commit: httpd-2.0/build build.mk config-stubs

Posted by rb...@covalent.net.
> > config.m4 sorts before config##.m4  ... ord('.') < ord('0')
> > 
> > We don't need to put any switches on the sort, which should help with
> > portability.
> 
> take a look at the script again please.  We can't just sort on config*.m4,
> because the path gets in the way.  We also don't know how many elements
> are in the path, so we can't just use -k to specify a specific path
> element.  For that reason, we re-arrange the path elements to be:
> 
> config*.m4/path/to/file
> 
> Then we sort, and then we re-order it back.  Because of that, we can't
> just use sort.  However, sort -n -b works just fine.

I'm sorry, that makes little to no sense, because we are sorting based on
config*.m4.  My fault.  The problem is that we actually re-order the files
to:

*config.m4./path/to/file.

Obviosuly, every number is < c, so we can't just use sort.  I did put the
number first to avoid having to zero-pad, and we can use -n -b, so what we
have works just fine.

Ryan

_______________________________________________________________________________
Ryan Bloom                        	rbb@apache.org
406 29th St.
San Francisco, CA 94131
-------------------------------------------------------------------------------


Re: cvs commit: httpd-2.0/build build.mk config-stubs

Posted by rb...@covalent.net.
> > Small problem with that.  It forces us to use config0.m4 for the basic
> > config.m4 files, i.e. those which should be first.  That is one of the
> > things I was trying to avoid doing.
> 
> config.m4 sorts before config##.m4  ... ord('.') < ord('0')
> 
> We don't need to put any switches on the sort, which should help with
> portability.

take a look at the script again please.  We can't just sort on config*.m4,
because the path gets in the way.  We also don't know how many elements
are in the path, so we can't just use -k to specify a specific path
element.  For that reason, we re-arrange the path elements to be:

config*.m4/path/to/file

Then we sort, and then we re-order it back.  Because of that, we can't
just use sort.  However, sort -n -b works just fine.

Ryan

_______________________________________________________________________________
Ryan Bloom                        	rbb@apache.org
406 29th St.
San Francisco, CA 94131
-------------------------------------------------------------------------------


Re: cvs commit: httpd-2.0/build build.mk config-stubs

Posted by Greg Stein <gs...@lyra.org>.
On Sat, Dec 30, 2000 at 09:51:36AM -0800, rbb@covalent.net wrote:
> > > [daleg@lithium]~>uname -a
> > > SunOS lithium.elemental.org 5.8 Generic_108528-04 sun4u sparc SUNW,Ultra-2
> > > [daleg@lithium]~>/usr/bin/sort -g
> > > /usr/bin/sort: illegal option -- g
> > > usage: sort [-cmu] [-o output] [-T directory] [-S mem] [-z recsz]
> > >         [-dfiMnr] [-b] [-t char] [-k keydef] [+pos1 [-pos2]] files...
> > > 
> > > Perhaps you're looking for 'sort -n -b' ?
> > 
> > Nah. We can probably just drop the numeric sort and state that the number
> > must be a single digit. Alternatively, we can use two digits and zero-pad
> > (e.g. config05.m4). With the zero padding, we'll get the proper sort order.
> 
> Small problem with that.  It forces us to use config0.m4 for the basic
> config.m4 files, i.e. those which should be first.  That is one of the
> things I was trying to avoid doing.

config.m4 sorts before config##.m4  ... ord('.') < ord('0')

We don't need to put any switches on the sort, which should help with
portability.

Cheers,
-g

-- 
Greg Stein, http://www.lyra.org/

Re: cvs commit: httpd-2.0/build build.mk config-stubs

Posted by rb...@covalent.net.
> > [daleg@lithium]~>uname -a
> > SunOS lithium.elemental.org 5.8 Generic_108528-04 sun4u sparc SUNW,Ultra-2
> > [daleg@lithium]~>/usr/bin/sort -g
> > /usr/bin/sort: illegal option -- g
> > usage: sort [-cmu] [-o output] [-T directory] [-S mem] [-z recsz]
> >         [-dfiMnr] [-b] [-t char] [-k keydef] [+pos1 [-pos2]] files...
> > 
> > Perhaps you're looking for 'sort -n -b' ?
> 
> Nah. We can probably just drop the numeric sort and state that the number
> must be a single digit. Alternatively, we can use two digits and zero-pad
> (e.g. config05.m4). With the zero padding, we'll get the proper sort order.

Small problem with that.  It forces us to use config0.m4 for the basic
config.m4 files, i.e. those which should be first.  That is one of the
things I was trying to avoid doing.

Ryan

_______________________________________________________________________________
Ryan Bloom                        	rbb@apache.org
406 29th St.
San Francisco, CA 94131
-------------------------------------------------------------------------------


Re: cvs commit: httpd-2.0/build build.mk config-stubs

Posted by Greg Stein <gs...@lyra.org>.
On Fri, Dec 29, 2000 at 09:50:53PM -0500, Dale Ghent wrote:
> On 29 Dec 2000, Jeff Trawick wrote:
> 
> | > According to my man pages:
> | > 
> | >        -g     compare according to general numerical value, imply
> | >               -b
> | 
> | Well, it has to go.  The "sort -g" breaks OS/390, Tru64, and (I think)
> | Solaris.  (I don't have the Solaris configure output handy but "make"
> | dies at the same point on Solaris as on Tru64, and Tru64 dies because
> | of the "sort -g".)
> 
> [daleg@lithium]~>uname -a
> SunOS lithium.elemental.org 5.8 Generic_108528-04 sun4u sparc SUNW,Ultra-2
> [daleg@lithium]~>/usr/bin/sort -g
> /usr/bin/sort: illegal option -- g
> usage: sort [-cmu] [-o output] [-T directory] [-S mem] [-z recsz]
>         [-dfiMnr] [-b] [-t char] [-k keydef] [+pos1 [-pos2]] files...
> 
> Perhaps you're looking for 'sort -n -b' ?

Nah. We can probably just drop the numeric sort and state that the number
must be a single digit. Alternatively, we can use two digits and zero-pad
(e.g. config05.m4). With the zero padding, we'll get the proper sort order.

Cheers,
-g

-- 
Greg Stein, http://www.lyra.org/

Re: cvs commit: httpd-2.0/build build.mk config-stubs

Posted by Dale Ghent <da...@elemental.org>.
On 29 Dec 2000, Jeff Trawick wrote:

| > According to my man pages:
| > 
| >        -g     compare according to general numerical value, imply
| >               -b
| 
| Well, it has to go.  The "sort -g" breaks OS/390, Tru64, and (I think)
| Solaris.  (I don't have the Solaris configure output handy but "make"
| dies at the same point on Solaris as on Tru64, and Tru64 dies because
| of the "sort -g".)

[daleg@lithium]~>uname -a
SunOS lithium.elemental.org 5.8 Generic_108528-04 sun4u sparc SUNW,Ultra-2
[daleg@lithium]~>/usr/bin/sort -g
/usr/bin/sort: illegal option -- g
usage: sort [-cmu] [-o output] [-T directory] [-S mem] [-z recsz]
        [-dfiMnr] [-b] [-t char] [-k keydef] [+pos1 [-pos2]] files...

Perhaps you're looking for 'sort -n -b' ?

/dale


Re: cvs commit: httpd-2.0/build build.mk config-stubs

Posted by Jeff Trawick <tr...@bellsouth.net>.
rbb@covalent.net writes:

> > >   -dir=$1
> > >   -for stubdir in `find $dir -type d`; do
> > >   -    if [ -r $stubdir/config.m4 ]; then
> > >   -        echo "sinclude($stubdir/config.m4)"
> > >   +for configfiles in `find . -name "config*.m4" | \
> > >   +         sed 's#\(.*\)\/config\(.*\)\.m4#\2config.m4\1#' | \
> > >   +         sort -g | \
> > >   +         sed 's#\(.*\)config.m4\(.*\)#\2/config\1.m4#g'`; do
> > >   +    if [ -r $configfiles ]; then
> > >   +        echo "sinclude($configfiles)"
> > 
> > What does "sort -g" do?  GNU sort man page doesn't describe "-g" and
> > OS/390 sort doesn't accept "-g".
> 
> According to my man pages:
> 
>        -g     compare according to general numerical value, imply
>               -b

Well, it has to go.  The "sort -g" breaks OS/390, Tru64, and (I think)
Solaris.  (I don't have the Solaris configure output handy but "make"
dies at the same point on Solaris as on Tru64, and Tru64 dies because
of the "sort -g".)

I'll try to find some time in the next 48 hrs to play with the code
above to see *exactly* what it does (yeah, I understand that it
creates an order of config*.m4 files), assuming of course that the
"-g" is still present at that time :)

Best wishes to all...
-- 
Jeff Trawick | trawickj@bellsouth.net | PGP public key at web site:
       http://www.geocities.com/SiliconValley/Park/9289/
             Born in Roswell... married an alien...

Re: cvs commit: httpd-2.0/build build.mk config-stubs

Posted by rb...@covalent.net.
> >   -dir=$1
> >   -for stubdir in `find $dir -type d`; do
> >   -    if [ -r $stubdir/config.m4 ]; then
> >   -        echo "sinclude($stubdir/config.m4)"
> >   +for configfiles in `find . -name "config*.m4" | \
> >   +         sed 's#\(.*\)\/config\(.*\)\.m4#\2config.m4\1#' | \
> >   +         sort -g | \
> >   +         sed 's#\(.*\)config.m4\(.*\)#\2/config\1.m4#g'`; do
> >   +    if [ -r $configfiles ]; then
> >   +        echo "sinclude($configfiles)"
> 
> What does "sort -g" do?  GNU sort man page doesn't describe "-g" and
> OS/390 sort doesn't accept "-g".

According to my man pages:

       -g     compare according to general numerical value, imply
              -b

Ryan

_______________________________________________________________________________
Ryan Bloom                        	rbb@apache.org
406 29th St.
San Francisco, CA 94131
-------------------------------------------------------------------------------