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

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

Thread Previous
From:
Claudio Nieder
Date:
February 6, 2000 15:17
Subject:
[ID 20000206.001] Bug in IO::Handle method ioctl
Message ID:
389E013A.7187C08@claudio.ch
This is a bug report for perl from private@claudio.ch,
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 ...
 $file->ioctl(someReadOP,$value);

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

This is ioctl in IO::Handle.pm

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
zic
 manual page 1999.

Summary of my perl5 (5.0 patchlevel 5 subversion 3) configuration:
  Platform:
    osname=linux, osvers=2.2.13, archname=ppc-linux-thread
    uname='linux pb.claudio.ch 2.2.13 #1 tue oct 12 22:10:46 cest 1999 ppc
unknow
n '
    hint=previous, useposix=true, d_sigaction=define
    usethreads=define useperlio=undef d_sfio=undef
  Compiler:
    cc='cc', optimize='-O2', gccversion=egcs-2.91.66 19990314 (egcs-1.1.2
release
)
    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 =''
    libpth=/usr/lib
    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:
    /opt/perl-5.005_03/lib/5.00503/ppc-linux-thread
    /opt/perl-5.005_03/lib/5.00503
    /opt/perl-5.005_03/lib/site_perl/5.005/ppc-linux-thread
    /opt/perl-5.005_03/lib/site_perl/5.005
    .

---
Environment for perl 5.00503:
    HOME=/home/claudio
    LANG (unset)
    LANGUAGE (unset)
    LD_LIBRARY_PATH=/usr/lib
    LOGDIR (unset)
    PATH=/usr/bin
    PERL_BADLANG (unset)
    SHELL=/usr/bin/bash


-- 
Claudio Nieder, Kanalweg 1, CH-8610 Uster ,'`.,'`.,'`.,'`.,'`.,'`.,'`
mailto:private@claudio.ch http://www.claudio.ch phone:+41 79 357 6743
Thread Previous


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