develooper Front page | perl.perl5.porters | Postings from August 2008

[perl #24198] Bad default-domainname extraction in Configure-Script may cause infinite loops in perl-tests

From:
Bram via RT
Date:
August 7, 2008 06:16
Subject:
[perl #24198] Bad default-domainname extraction in Configure-Script may cause infinite loops in perl-tests
Message ID:
rt-3.6.HEAD-29759-1218114045-1803.24198-15-0@perl.org
On Mon Oct 13 08:36:22 2003, Henning.Rust@stud.uni-hannover.de wrote:
> This is a bug report for perl from hrust@stud.uni-hannover.de,
> generated with the help of perlbug 1.34 running under perl v5.8.0.
> 
> 
> -----------------------------------------------------------------
> [Please enter your report here]
> 
> The "Configure" Script attempts to extract the host's domainname
>    default
> value from a resolv.conf file, if all other ways fail. This is done by
> scanning the resolv.conf file for any lines containing "search
>    <domainname>"
> 
> If there are more than one "search <domainname>" line, e.g.:
> 
> search foo.bar.com
> search bar.com
> 
> the default domainname value will be extracted as:
> 
> "foo.bar.com
> bar.com"
> 
> i.e.: values from *both* "search <domainname>" lines, separated by
> a CR-Character!!
> 
> If using default values (as Gentoo Linux does it), Configure will
>    generate
> a config.sh file that contains entries such as:
> 
> mydomain='.foo.bar.com
> bar.com'
> 
> and
> 
> cf_email='user@foo.bar.com
> bar.com'
> 
> i.e. CR-Characters within quoted string-constants.
> 
> - which causes Config::NEXTKEY in lib/Config.pm to fail to correctly
>   locate the quote-characters.
> - which causes Config::NEXTKEY to never reach its terminate condition
>   (len == 0)
> - which causes an infinite loop for every use of "keys %Config"
> - which causes lib/Config.t (and maybe other tests as well ) to hang
>   in an infinite loop.
> - which causes trouble to unexperienced Gentoo-Linux-Users as it is
>   not so easy to track down and work around the problem...
> 

It currently seems to remove the carriage return but it still sets an 
incorrect default value for mydomain (and an incorrect emailaddress).

resolv.conf:

search domain1.com
search domain2.com

In config.sh:
cf_email='bram@domain1.com domain2.com'
mydomain='.domain1.com domain2.com'
perladmin='bram@domain1.com domain2.com'


With the attached patch only the first 'search' is used turning it into:
cf_email='bram@domain1.com'
mydomain='.domain1.com'
perladmin='bram@domain1.com'


I also removed the  ./tr '[A-Z]' '[a-z]'  because it is repeated below 
it:

mydomain="$tans"
          
: translate upper to lower if necessary
case "$mydomain" in  
*[A-Z]*)
        echo "(Normalizing case in your domain name)"
        mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
        ;;
esac


Kind regards,

Bram



nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About