The following reply was made to PR config/2710; it has been noted by GNATS.
From: John Caldwell <[EMAIL PROTECTED]>
To: "Ralf S. Engelschall" <[EMAIL PROTECTED]>
Cc: [EMAIL PROTECTED]
Subject: Re: config/2710: configure breaks if you have more than one 'search'
entry in the resolv.conf.
Date: Wed, 29 Jul 1998 23:48:50 -0700 (PDT)
On Sat, 25 Jul 1998, Ralf S. Engelschall wrote:
>
> A few statements:
>
> 1. The configure is not such terrible because we like it this way.
> Its mostly such terrible to be portable. If the goal would be less
> complicated constructs we would write it in Icon or Perl or whatever
> powerful language. But we only have Bourne-Shell and a few
> semi-standardized tools we can use in a portable way. So just saying "some
> needs to rewrite this configure. its terrible" is not very realistic. At
> least not when you are confronted with such a lot of platforms which such
> a
> lot of broken tools.
>
> 2. Yes, the sed used construct is horrible. But its maximum portable
> this way (even if there is a bug with the two search entries). Replacing
> it
> with your suggested Awk-based solution is perhaps possible. But you will
> not doubt me when I say that the chance is high that this one fails under
> some platforms. Awks are even more broken out there in the world then some
> Sed's, really.
>
> 3. When you think about the problematic of determining the domainname
> of a machine _IN A PORTABLE WAY_ you recognize that trying to guess it
> from
> some information inside /etc/resolv.conf is the only acceptable way. Sure,
> its not the correct way on some platforms, but all other ways like
> nslookup-based approaches, uname-based approaches or even checking
> /etc/hosts is either non-portable or results in even more incorrect
> values.
>
all good points, and i understand now why the configure is how it is.
> But you're right, we missed at least the fact that perhaps there are more
> than
> one "search" entry in /etc/resolv.conf. This is a bug. Thanks discovering
> this. But IMHO the best and most portable way is to just add a "head -1"
> after
> the egrep.
>
> BTW, even you suggested
>
> domainname="`awk '/search/ { print /^./ ? $2 : "."$2 }'`"
>
> as a better solution you also forgot the "multiple-search" problem: It fails
> also when more "search" entries exist! It just prints all of them. And
> additionally it is non-portable because it uses nested double quotes which
> some braindead Bourne Shell variants dislike most.
>
I realized that it would do exactly the same thing; i wasnt trying to get
it to return just the first one.
> So, please understand that we only add "head -1" for Apache 1.3.2 and have to
> ignore your suggestion because of portability. Nevertheless thanks for the
> report.
>
IMHO in the future, it would be better to ask the user for a default
domain name if more than one is found in /etc/resolv.conf. There isnt any
fast and true policy that says people will put their real domain as the
first entry (or at all!)
In this respect, configure needs to be smarter, and if it gets more than
one entry, to grab the first one and say "is your domain name foo.com? if
not, enter it here:" Although i know this is quite different from what
the configure does now, blindly assuming that the 'head -1' will assure
you get the real domain name doesnt sound like a good solution to me.
Ironically- since by default configure is silent, I would have never known
until apache was compiled that it picked the wrong domain name, if that
bug hadnt been there.
--
-------------------------
| John Caldwell
| [EMAIL PROTECTED]
| http://www.lake.ml.org/
-------------------------