develooper Front page | perl.perl5.porters | Postings from March 2006

[perl #38783] Constants with undef value deliver arbitrary value at first call

Markus . Herber @ eds . com
March 22, 2006 03:33
[perl #38783] Constants with undef value deliver arbitrary value at first call
Message ID:
# New Ticket Created by 
# Please include the string:  [perl #38783]
# in the subject line of all future correspondence about this issue. 
# <URL: >

Message-Id: <5.8.8_28049_1143022911@eadw01>

This is a bug report for perl from,
generated with the help of perlbug 1.35 running under perl v5.8.8.

[Please enter your report here]


I'm installing perl on an x86 Solaris 10 machine using gcc 3.4.6 and
found a strange behaviour which I think is a bug in perl 5.8.x:

Constants defined via XS are not as constant as expected for the perl
5.8.x series. I found following bug with 5.8.8, 5.8.7, and 5.8.2, but
not with 5.6.1 and 5.6.2, (except for 5.6.1 all with gcc 3.4.6) when
installing IO::Tty version 1.02:

perl Makefile.PL   => OK
make               => OK
make test          => spits out a warning, though reporting all tests OK

The warning is:

Use of uninitialized value in ioctl at /local/root/build/perl/addons/tmp/IO-Tty-1.02/blib/lib/IO/ line 127.
warning: TIOCSCTTY failed, slave might not be set as controlling terminal: Invalid argument at /local/root/build/perl/addons/tmp/IO-Tty-1.02/blib/lib/IO/ line 128.
ok 2

Actually this warning should be impossible as TIOCSCTTY should be a
  if (defined TIOCSCTTY) {
    if (not defined ioctl( ${*$self}{'io_pty_slave'}, TIOCSCTTY, 0 )) {
      warn "warning: TIOCSCTTY failed, slave might not be set as controlling terminal: $!" if $^W;
  } elsif (defined TCSETCTTY) {
    if (not defined ioctl( ${*$self}{'io_pty_slave'}, TCSETCTTY, 0 )) {
      warn "warning: TCSETCTTY failed, slave might not be set as controlling terminal: $!" if $^W;

I put following code in front of the first if(...) it and found out,
that when TIOCSCTTY called first time it returns the string which is
argument to the next following warn():

use Data::Dumper;

I got following output (and the warning vanished):

$VAR1 = 'Error: could not connect pty as controlling terminal!
$VAR1 = undef;
ok 2

If I replace the first if(...) by if(0) I get a similar warning for
TCSETCTTY from the elsif() part. This constant should also be undef.
Thus the effect is not limited to one constant.

I found their definition in xssubs.c after 'perl Makefile.PL':
newCONSTSUB(stash, "TCSETCTTY", &PL_sv_undef);
newCONSTSUB(stash, "TIOCSCTTY", &PL_sv_undef);

Unfortunately I have no deeper insight in perl internals to efficiently
debug this further.

I experienced also a lot of errors when testing Tk (only 27% success); I
currently assume that this may be related, but I have not had a closer
look at the Tk problems, as Tk is much more complex...

Best Regards,
Markus Herber.

[Please do not change anything below this line]
Site configuration information for perl v5.8.8:

Configured by root at Thu Mar 16 18:35:29 CET 2006.

Summary of my perl5 (revision 5 version 8 subversion 8) configuration:
    osname=solaris, osvers=2.10, archname=i86pc-solaris-thread-multi
    uname='sunos eadw01 5.10 generic_118844-26 i86pc i386 i86pc '
    hint=recommended, useposix=true, d_sigaction=define
    usethreads=define use5005threads=undef useithreads=define
    useperlio=define d_sfio=undef uselargefiles=define usesocks=undef
    use64bitint=undef use64bitall=undef uselongdouble=undef
    usemymalloc=n, bincompat5005=undef
    cc='gcc', ccflags ='-I/opt/perl-5.8.8/include -D_REENTRANT
-fno-strict-aliasing -pipe -Wdeclaration-after-statement
    cppflags='-D_REENTRANT -fno-strict-aliasing -pipe
-Wdeclaration-after-statement -I/usr/local/include'
    ccversion='', gccversion='3.4.6', gccosandvers='solaris2.10'
    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',
    alignbytes=4, prototype=define
  Linker and Libraries:
    ld='gcc', ldflags =' -L/usr/local/lib '
    libpth=/opt/perl-5.8.8/lib /usr/local/lib /usr/lib /usr/ccs/lib
    libs=-lsocket -lnsl -ldl -lm -lpthread -lc
    perllibs=-lsocket -lnsl -ldl -lm -lpthread -lc
    libc=/lib/, so=so, useshrplib=false, libperl=libperl.a
  Dynamic Linking:
    dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags=' '
    cccdlflags='-fPIC', lddlflags='-G -L/usr/local/lib'

Locally applied patches:

@INC for perl v5.8.8:

Environment for perl v5.8.8:
    LANGUAGE (unset)
    LD_LIBRARY_PATH (unset)
    LOGDIR (unset)

    PERL_BADLANG (unset)
    SHELL=/bin/ksh Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About