Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bad default-domainname extraction in Configure-Script may cause infinite loops in perl-tests #6837

Closed
p5pRT opened this issue Oct 13, 2003 · 7 comments

Comments

@p5pRT
Copy link

p5pRT commented Oct 13, 2003

Migrated from rt.perl.org#24198 (status was 'resolved')

Searchable as RT24198$

@p5pRT
Copy link
Author

p5pRT commented Oct 13, 2003

From Henning.Rust@stud.uni-hannover.de

Created by hrust@stud.uni-hannover.de

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...

Perl Info

Flags:
    category=install
    severity=low

Site configuration information for perl v5.8.0:

Configured by jey at Mon Oct 13 13:05:13 CEST 2003.

Summary of my perl5 (revision 5.0 version 8 subversion 0) configuration:
  Platform:
    osname=linux, osvers=2.4.20-gentoo-r7, archname=i686-linux
    uname='linux inspiron 2.4.20-gentoo-r7 #13 thu oct 2 19:00:03 cest 2003 i686 intel(r) celeron(r) cpu 2.20ghz genuineintel gnulinux '
    config_args='-des -Darchname=i686-linux -Dcc=gcc -Dprefix=/usr -Dvendorprefix=/usr -Dsiteprefix=/usr -Dlocincpth=  -Doptimize=-O3 -march=pentium2 -O3 -pipe -Duselargefiles -Dd_dosuid -Dd_semctl_semun -Dscriptdir=/usr/bin -Dman3ext=3pm -Dcf_by=Gentoo -Ud_csh -Di_gdbm -Di_db -Di_ndbm'
    hint=recommended, useposix=true, d_sigaction=define
    usethreads=undef use5005threads=undef useithreads=undef usemultiplicity=undef
    useperlio=define d_sfio=undef uselargefiles=define usesocks=undef
    use64bitint=undef use64bitall=undef uselongdouble=undef
    usemymalloc=n, bincompat5005=undef
  Compiler:
    cc='gcc', ccflags ='-DPERL5 -fno-strict-aliasing -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64',
    optimize='-O3 -march=pentium2 -O3 -pipe',
    cppflags='-DPERL5 -DPERL5 -fno-strict-aliasing'
    ccversion='', gccversion='3.2.3 20030422 (Gentoo Linux 1.4 3.2.3-r2, propolice)', gccosandvers=''
    intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=1234
    d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=12
    ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=8
    alignbytes=4, prototype=define
  Linker and Libraries:
    ld='gcc', ldflags =' -L/usr/local/lib'
    libpth=/usr/local/lib /lib /usr/lib
    libs=-lpthread -lnsl -lndbm -lgdbm -ldb -ldl -lm -lc -lcrypt -lutil
    perllibs=-lpthread -lnsl -ldl -lm -lc -lcrypt -lutil
    libc=/lib/libc-2.3.2.so, so=so, useshrplib=false, libperl=libperl.a
    gnulibc_version='2.3.2'
  Dynamic Linking:
    dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-rdynamic'
    cccdlflags='-fpic', lddlflags='-shared -L/usr/local/lib'

Locally applied patches:



@INC for perl v5.8.0:
    /etc/perl
    /usr/lib/perl5/site_perl/5.8.0/i686-linux
    /usr/lib/perl5/site_perl/5.8.0
    /usr/lib/perl5/site_perl
    /usr/lib/perl5/vendor_perl/5.8.0/i686-linux
    /usr/lib/perl5/vendor_perl/5.8.0
    /usr/lib/perl5/vendor_perl
    /usr/lib/perl5/5.8.0/i686-linux
    /usr/lib/perl5/5.8.0
    /usr/local/lib/site_perl
    .


Environment for perl v5.8.0:
    HOME=/root
    LANG (unset)
    LANGUAGE (unset)
    LD_LIBRARY_PATH (unset)
    LOGDIR (unset)
    PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/opt/bin:/usr/i686-pc-linux-gnu/gcc-bin/3.2:/opt/Acrobat5:/usr/X11R6/bin:/opt/blackdown-jdk-1.4.1/bin:/opt/blackdown-jdk-1.4.1/jre/bin:/usr/qt/3/bin:/usr/kde/3.1/sbin:/usr/kde/3.1/bin
    PERL_BADLANG (unset)
    SHELL=/bin/bash

hepp..
        Henning

--
henning@uni.de

@p5pRT
Copy link
Author

p5pRT commented Oct 16, 2003

From @eserte

Henning Rust (via RT) <perlbug-followup@​perl.org> writes​:

# New Ticket Created by Henning Rust
# Please include the string​: [perl #24198]
# in the subject line of all future correspondence about this issue.
# <URL​: http​://rt.perl.org/rt2/Ticket/Display.html?id=24198 >

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...

Adding
  | sed -e '2,$ d'
or
  | head -1
(whatever is more portable) to the resolv.conf-munching lines
Configure should help.

Regards,
  Slaven

--
Slaven Rezic - slaven@​rezic.de

  tknotes - A knotes clone, written in Perl/Tk.
  http​://ptktools.sourceforge.net/#tknotes

@p5pRT
Copy link
Author

p5pRT commented Oct 17, 2003

From @doughera88

On Thu, 16 Oct 2003, Slaven Rezic wrote​:

Henning Rust (via RT) <perlbug-followup@​perl.org> writes​:

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 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'

Adding
| sed -e '2,$ d'
or
| head -1
(whatever is more portable) to the resolv.conf-munching lines
Configure should help.

The usual portable idiom is
  $sed 1q

--
  Andy Dougherty doughera@​lafayette.edu

@p5pRT
Copy link
Author

p5pRT commented Aug 7, 2008

From p5p@spam.wizbit.be

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

@p5pRT
Copy link
Author

p5pRT commented Aug 7, 2008

From p5p@spam.wizbit.be

patch_Configure

@p5pRT
Copy link
Author

p5pRT commented Aug 8, 2008

From @Tux

Thanks, applied in change #34188

@p5pRT
Copy link
Author

p5pRT commented Aug 8, 2008

@Tux - Status changed from 'open' to 'resolved'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant