develooper Front page | perl.perl5.porters | Postings from February 2000

[ID 20000206.001] Bug in IO::Handle method ioctl

Thread Previous
Claudio Nieder
February 6, 2000 15:17
[ID 20000206.001] Bug in IO::Handle method ioctl
Message ID:
This is a bug report for perl from,
generated with the help of perlbug 1.26 running under perl 5.00503.

[Please enter your report here]

 my $file=new IO::File;
 ... correct open of file ...

does not work, while ioctl($file,someReadOp,$value) does.

This is ioctl in

560:  sub ioctl {
561:    @_ == 3 || croak 'usage: $io->ioctl( OP, VALUE );';
562:    my ($io, $op, $val) = @_;
563:    my $r = ioctl($io, $op, $val);
564:    defined $r && $r eq "0 but true" ? 0 : $r;
565:  }

The $val passed to ioctl in line 563 is a local variable because
of the declaration in line 562. So any ioctl which reads a value
will fill in $val instead of the parameter passed to $file->ioctl.

To fix this, line 563 has to be changed into:

        my $r = ioctl($io, $op, $_[2]);

This works (tested) because $_[2] is really the 2nd parameter
passed to $file->ioctl(someReadOp,$value).

[Please do not change anything below this line]

Site configuration information for perl 5.00503:

Configured by claudio at Sat Nov 13 01:05:54 Local time zone must be set--see
 manual page 1999.

Summary of my perl5 (5.0 patchlevel 5 subversion 3) configuration:
    osname=linux, osvers=2.2.13, archname=ppc-linux-thread
    uname='linux 2.2.13 #1 tue oct 12 22:10:46 cest 1999 ppc
n '
    hint=previous, useposix=true, d_sigaction=define
    usethreads=define useperlio=undef d_sfio=undef
    cc='cc', optimize='-O2', gccversion=egcs-2.91.66 19990314 (egcs-1.1.2
    cppflags='-D_REENTRANT -Dbool=char -DHAS_BOOL'
    ccflags ='-D_REENTRANT -Dbool=char -DHAS_BOOL'
    stdchar='char', d_stdstdio=undef, usevfork=false
    intsize=4, longsize=4, ptrsize=4, doublesize=8
    d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=8
    alignbytes=8, usemymalloc=n, prototype=define
  Linker and Libraries:
    ld='cc', ldflags =''
    libs=-lnsl -lndbm -ldb -ldl -lm -lpthread -lc -lposix -lcrypt
    libc=, so=so, useshrplib=false, libperl=libperl.a
  Dynamic Linking:
    dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-rdynamic'
    cccdlflags='-fpic', lddlflags='-shared'

Locally applied patches:

@INC for perl 5.00503:

Environment for perl 5.00503:
    LANG (unset)
    LANGUAGE (unset)
    LOGDIR (unset)
    PERL_BADLANG (unset)

Claudio Nieder, Kanalweg 1, CH-8610 Uster ,'`.,'`.,'`.,'`.,'`.,'`.,'` phone:+41 79 357 6743
Thread Previous Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About