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

error in documentation for POSIX::pipe #7599

Closed
p5pRT opened this issue Nov 18, 2004 · 7 comments
Closed

error in documentation for POSIX::pipe #7599

p5pRT opened this issue Nov 18, 2004 · 7 comments

Comments

@p5pRT
Copy link

p5pRT commented Nov 18, 2004

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

Searchable as RT32486$

@p5pRT
Copy link
Author

p5pRT commented Nov 18, 2004

From chris@ex-parrot.com

Created by chris@caesious.cold.local

In the documentation for the POSIX module, there is the statement,

  pipe Create an interprocess channel. This returns file descriptors like those returned by
  "POSIX​::open".

  ($fd0, $fd1) = POSIX​::pipe();
  POSIX​::write( $fd0, "hello", 5 );
  POSIX​::read( $fd1, $buf, 5 );

  See also "pipe" in perlfunc.

This is wrong. $fd0 is writable, $fd1 is readable. The file
descriptors in the POSIX​::write and POSIX​::read functions
should be exchanged as appropriate.

Perl Info

Flags:
    category=docs
    severity=medium

This perlbug was built using Perl v5.8.5 - Tue Aug 10 17:59:43 BST 2004
It is being executed now by  Perl v5.8.5 - Tue Aug 10 17:47:29 BST 2004.

Site configuration information for perl v5.8.5:

Configured by chris at Tue Aug 10 17:47:29 BST 2004.

Summary of my perl5 (revision 5 version 8 subversion 5) configuration:
  Platform:
    osname=linux, osvers=2.4.25, archname=i686-linux
    uname='linux caesious.cold.local 2.4.25 #5 smp thu jul 15 19:59:33 bst 2004 i686 unknown '
    config_args='-d'
    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='cc', ccflags ='-fno-strict-aliasing -pipe -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -I/usr/include/gdbm',
    optimize='-O2',
    cppflags='-fno-strict-aliasing -pipe -I/usr/local/include -I/usr/include/gdbm'
    ccversion='', gccversion='2.96 20000731 (Red Hat Linux 7.3 2.96-110)', 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='cc', ldflags =' -L/usr/local/lib'
    libpth=/usr/local/lib /lib /usr/lib
    libs=-lnsl -lndbm -lgdbm -ldl -lm -lcrypt -lutil -lc
    perllibs=-lnsl -ldl -lm -lcrypt -lutil -lc
    libc=/lib/libc-2.2.5.so, so=so, useshrplib=false, libperl=libperl.a
    gnulibc_version='2.2.5'
  Dynamic Linking:
    dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-Wl,-E'
    cccdlflags='-fpic', lddlflags='-shared -L/usr/local/lib'

Locally applied patches:
    


@INC for perl v5.8.5:
    /home/chris/software/useful/perllib
    /home/chris/software/useful/perllib
    /home/chris/software/useful/perllib
    /usr/local/lib/perl5/5.8.5/i686-linux
    /usr/local/lib/perl5/5.8.5
    /usr/local/lib/perl5/site_perl/5.8.5/i686-linux
    /usr/local/lib/perl5/site_perl/5.8.5
    /usr/local/lib/perl5/site_perl
    .


Environment for perl v5.8.5:
    HOME=/home/chris
    LANG (unset)
    LANGUAGE (unset)
    LD_LIBRARY_PATH (unset)
    LOGDIR (unset)
    PATH=/software/bin:/bin:/sbin:/usr/bin:/usr/sbin:/usr/libexec:/usr/local/bin:/usr/local/libexec:/usr/X11R6/bin:/software/bin:/software/sbin:/software/scripts:/usr/games:/software/apps/mozilla:/software/apps/Acrobat4/bin:/software/exim-3.03/bin:/software/scheme-7.4/bin:/software/squid-2.2.STABLE5/bin:/software/freeciv-1.9.0/bin:/software/j2sdk1.4.1_01/bin:/home/chris/bin:/home/chris/bin:/home/chris/photos/bin:/home/chris/bin/caesious.cold.local
    PERL5LIB=:/home/chris/software/useful/perllib:/home/chris/software/useful/perllib:/home/chris/software/useful/perllib
    PERL_BADLANG (unset)
    SHELL=/bin/bash

@p5pRT
Copy link
Author

p5pRT commented Nov 19, 2004

From @rgs

chris@​ex-parrot.com (via RT) wrote​:

In the documentation for the POSIX module, there is the statement,

   pipe    Create an interprocess channel\.  This returns file descriptors like those returned by
           "POSIX​::open"\.

                   \($fd0\, $fd1\) = POSIX​::pipe\(\);
                   POSIX​::write\( $fd0\, "hello"\, 5 \);
                   POSIX​::read\( $fd1\, $buf\, 5 \);

           See also "pipe" in perlfunc\.

This is wrong. $fd0 is writable, $fd1 is readable. The file
descriptors in the POSIX​::write and POSIX​::read functions
should be exchanged as appropriate.

Good catch, I've done it as change 23518 to bleadperl.

@p5pRT
Copy link
Author

p5pRT commented Nov 19, 2004

The RT System itself - Status changed from 'new' to 'open'

@p5pRT
Copy link
Author

p5pRT commented Nov 19, 2004

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

@p5pRT p5pRT closed this as completed Nov 19, 2004
@p5pRT
Copy link
Author

p5pRT commented Nov 19, 2004

From @schwern

On Fri, Nov 19, 2004 at 10​:48​:48AM +0100, Rafael Garcia-Suarez wrote​:

This is wrong. $fd0 is writable, $fd1 is readable. The file
descriptors in the POSIX​::write and POSIX​::read functions
should be exchanged as appropriate.

Good catch, I've done it as change 23518 to bleadperl.

If you call things $fd0 and $fd1 folks are going to get it wrong.

--- ext/POSIX/POSIX.pod 2004/11/19 19​:25​:52 1.1
+++ ext/POSIX/POSIX.pod 2004/11/19 19​:26​:23
@​@​ -955,9 +955,9 @​@​
Create an interprocess channel. This returns file descriptors like those
returned by C<POSIX​::open>.

- ($fd0, $fd1) = POSIX​::pipe();
- POSIX​::write( $fd1, "hello", 5 );
- POSIX​::read( $fd0, $buf, 5 );
+ my($read, $write) = POSIX​::pipe();
+ POSIX​::write( $write, "hello", 5 );
+ POSIX​::read( $read, $buf, 5 );

See also L<perlfunc/pipe>.

--
Michael G Schwern schwern@​pobox.com http​://www.pobox.com/~schwern/
And it's made from all-natural baby skin, so you know it's good for the
environment.
  http​://www.goats.com/archive/000606.html

@p5pRT
Copy link
Author

p5pRT commented Nov 19, 2004

From @petdance

On Fri, Nov 19, 2004 at 02​:28​:56PM -0500, Michael G Schwern (schwern@​pobox.com) wrote​:

If you call things $fd0 and $fd1 folks are going to get it wrong.

Yay Schwern!

See also my rant at http​://www.oreillynet.com/pub/wlg/4535

  Any variable that relies on a numeral to distinguish it from a
  similar variable needs to be refactored, immediately.

xoxo,
Andy

--
Andy Lester => andy@​petdance.com => www.petdance.com => AIM​:petdance

@p5pRT
Copy link
Author

p5pRT commented Nov 23, 2004

From @rgs

Michael G Schwern wrote​:

On Fri, Nov 19, 2004 at 10​:48​:48AM +0100, Rafael Garcia-Suarez wrote​:

This is wrong. $fd0 is writable, $fd1 is readable. The file
descriptors in the POSIX​::write and POSIX​::read functions
should be exchanged as appropriate.

Good catch, I've done it as change 23518 to bleadperl.

If you call things $fd0 and $fd1 folks are going to get it wrong.

--- ext/POSIX/POSIX.pod 2004/11/19 19​:25​:52 1.1
+++ ext/POSIX/POSIX.pod 2004/11/19 19​:26​:23

Thanks, applied as #23527.

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