[perl #70045] [PATCH] Make IO::Socket::INET.accept() return an IO::Socket::INET object rather than a Parrot IO object
# New Ticket Created by Carlin Bingham # Please include the string: [perl #70045] # in the subject line of all future correspondence about this issue. # URL: http://rt.perl.org/rt3/Ticket/Display.html?id=70045 The current IO::Socket::INET.accept() returns a Parrot IO object rather than an instance of IO::Socket::INET. This means if you do: my $client = $server.accept(); $client.recv(); Parrot's recv() function is being called, not Rakudo's -- therefore you can't use recv with a parameter or call any of IO::Socket(::INET)'s methods. This patch makes accept() return an instance of IO::Socket::INET with the $!PIO attribute set to the Parrot IO object that accept() currently returns. This will affect applications that currently call recv() from the object created with accept(), as Parrot's recv() returns after every send but Rakudo's recv() (with no parameter) returns once the connection closes. From 087de23bf7c6727e405053690103196ab47323f5 Mon Sep 17 00:00:00 2001 From: Carlin Bingham car...@theintersect.org Date: Tue, 27 Oct 2009 22:28:24 +1300 Subject: [PATCH] Change IO::Socket::INET.accept() to return an instance of IO::Socket::INET rather than a Parrot IO object --- src/setting/IO/Socket/INET.pm |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/src/setting/IO/Socket/INET.pm b/src/setting/IO/Socket/INET.pm index b8c7c80..ce69631 100644 --- a/src/setting/IO/Socket/INET.pm +++ b/src/setting/IO/Socket/INET.pm @@ -48,6 +48,6 @@ class IO::Socket::INET does IO::Socket { } method accept() { -return $!PIO.accept(); +return IO::Socket::INET.new( :PIO( $!PIO.accept() ) ); } } -- 1.6.0.4
Re: [perl #70045] [PATCH] Make IO::Socket::INET.accept() return an IO::Socket::INET object rather than a Parrot IO object
Carlin Bingham (via RT) wrote: This patch makes accept() return an instance of IO::Socket::INET with the $!PIO attribute set to the Parrot IO object that accept() currently returns. This will affect applications that currently call recv() from the object created with accept(), as Parrot's recv() returns after every send but Rakudo's recv() (with no parameter) returns once the connection closes. Care to elaborate on the affect? does it imply break? If so I'd like some comments from some current users before applying... Cheers, Moritz
[perl #48070] [TODO] Replace Parrot::IO::Capture::Mini with IO::CaptureOutput
We've replaced Parrot::IO::Capture::Mini throughout with IO::CaptureOutput, so I'm removing Mini.pm from the distribution and resolving the ticket. Thanks to Alan Rocker for assistance.
[perl #48070] [TODO] Replace Parrot::IO::Capture::Mini with IO::CaptureOutput
Unless someone shouts, in a few hours I'll be applying a patch visible here: http://thenceforward.net/parrot/diff.io.captureoutput.txt
[perl #48070] [TODO] Replace Parrot::IO::Capture::Mini with IO::CaptureOutput
On Fri Dec 14 08:37:50 2007, [EMAIL PROTECTED] wrote: Unless someone shouts, in a few hours I'll be applying a patch visible here: http://thenceforward.net/parrot/diff.io.captureoutput.txt Patches applied to trunk in r23890.
[perl #48070] [TODO] Replace Parrot::IO::Capture::Mini with IO::CaptureOutput
Am working on this with new Parrot contributor Alan Rocker. We've transformed 17 tests so far; 65 to go.
[perl #48070] [TODO] Replace Parrot::IO::Capture::Mini with IO::CaptureOutput
# New Ticket Created by James Keenan # Please include the string: [perl #48070] # in the subject line of all future correspondence about this issue. # URL: http://rt.perl.org/rt3/Ticket/Display.html?id=48070 Several months ago I adapted CPAN module IO::Capture for use inside Parrot by creating Parrot::IO::Capture::Mini. Its main use is to capture verbose output during testing so as to reduce terminal clutter and to see if correct output is generated. I've run into a number of difficulties with P::IO::C::Mini and tonight began to explore the possibility of replacing it with CPAN module IO::CaptureOutput, maintainership of which has recently been assumed by David Golden. I have created a 'capture' branch in the Parrot repository to make and test this replacement in each of 80+ test files that currently use Mini. If CaptureOutput proves superior to Mini, I will advocate that it be used in trunk. If anyone wishes to help me out with this search-and-replace work, please check out the 'capture' branch and let me know. Thank you very much. kid51
Re: Parrot IO
Vishal Soni [EMAIL PROTECTED] wrote: Is Parrot IO going to be implemented via opcodes or PMC? I looked at some old email discussion. There were discussions on refactoring some IO opcodes to PMC's (e.g socket opcodes). Have we reached on any decisions as to how we are going to implement the Parrot IO? The latest thinking on this is located in the proposed (and I think incomplete) PDD 22. You can find it in docs/pdds/clip/pdd22_io.pod. Jonathan
Parrot IO
Hi, Is Parrot IO going to be implemented via opcodes or PMC? I looked at some old email discussion. There were discussions on refactoring some IO opcodes to PMC's (e.g socket opcodes). Have we reached on any decisions as to how we are going to implement the Parrot IO? -- Thanks, Vishal
Re: [perl #37876] Bug with Parrot::IO test
We can depend on 3.13 instead of 3.14. From File::Spec Changelog: 3.13 Tue Nov 15 23:50:37 CST 2005 [...] - abs2rel() used to return the empty string when its two arguments were identical, which made no sense. Now it returns curdir(). [Spotted by David Golden] So, maybe we should replace '.' by File::Spec-curdir() but I'm not sure. Alberto Parrot Assembler via RT wrote: Greetings, This message has been automatically generated in response to the creation of a parrotbug regarding: Bug with Parrot::IO test There is no need to reply to this message right now. Your ticket has been assigned an ID of [perl #37876]. Please include the string: [perl #37876] In the subject line of all future correspondence about this issue. To do so, you may reply to this message. Thank you, parrotbug https://rt.perl.org/rt3/Ticket/Display.html?id=37876 - Received: (qmail 21338 invoked by alias); 10 Dec 2005 20:37:58 - Received: (qmail 21334 invoked from network); 10 Dec 2005 20:37:58 - Received: from localhost (HELO la.mx.develooper.com) (127.0.0.1) by localhost with SMTP; 10 Dec 2005 20:37:58 - Received: (qmail 21330 invoked by alias); 10 Dec 2005 20:37:58 - Received: from la.mx.develooper.com (HELO x1.develooper.com) (63.251.223.176) by la.mx.develooper.com (qpsmtpd/0.28) with SMTP; Sat, 10 Dec 2005 12:37:51 -0800 Received: (qmail 21290 invoked by uid 225); 10 Dec 2005 20:37:48 - Received: (qmail 21286 invoked by alias); 10 Dec 2005 20:37:47 - Received: from eremita.di.uminho.pt (HELO eremita.di.uminho.pt) (193.136.19.131) by la.mx.develooper.com (qpsmtpd/0.28) with ESMTP; Sat, 10 Dec 2005 12:37:40 -0800 Received: by eremita.di.uminho.pt (Postfix, from userid 1000) id BEC9015704B; Sat, 10 Dec 2005 20:38:45 + (WET) Delivered-To: [EMAIL PROTECTED] Delivered-To: [EMAIL PROTECTED] Delivered-To: [EMAIL PROTECTED] User-Agent: Mutt/1.4.2.1i MIME-Version: 1.0 Subject: Bug with Parrot::IO test X-Spam-Status: No, hits=-2.6 required=8.0 tests=BAYES_00 Return-Path: [EMAIL PROTECTED] X-Spam-Check-BY: la.mx.develooper.com X-Old-Spam-Status: No, hits=-2.6 required=8.0 tests=BAYES_00 Content-Disposition: inline Date: Sat, 10 Dec 2005 20:38:45 + Received-SPF: neutral (x1.develooper.com: local policy) Received-SPF: pass (x1.develooper.com: local policy) X-Old-Spam-Check-BY: la.mx.develooper.com content-type: text/plain; charset=utf-8 Message-ID: [EMAIL PROTECTED] To: [EMAIL PROTECTED] Content-Transfer-Encoding: 8bit From: Alberto Manuel Brandao Simoes [EMAIL PROTECTED] X-RT-Original-Encoding: iso-8859-1 --- osname= darwin osvers= 8.0 arch= darwin-thread-multi-2level cc= cc --- Flags: category=core severity=medium ack=no --- New File::Spec returns '.' if the directory is the same, instead of the old ''. This diff should be in attach, I know, but I still need to learn how to do it, but the diff is very small :-) By the way, if there is a list of dependencies somewhere, File::Spec should be added with version 3.14 Index: t/perl/Parrot_IO.t === --- t/perl/Parrot_IO.t (revision 10433) +++ t/perl/Parrot_IO.t (working copy) @@ -97,7 +97,7 @@ ok($f1 $f2, 'file_with_name'); # Relative paths. -is($d-relative_path($d-path), '', 'relative_path same dir'); +is($d-relative_path($d-path), '.', 'relative_path same dir'); is($d1-relative_path($f1-path), 'file1.txt', 'relative_path same file'); is($d-relative_path($d1-path), 'one', 'relative_path down to dir'); is($d-relative_path($f1-path), catfile(qw(one file1.txt)), --- Summary of my parrot 0.4.0 (r10432) configuration: configdate='Sat Dec 10 19:56:11 2005' Platform: osname=darwin, archname=darwin-thread-multi-2level jitcapable=1, jitarchname=ppc-darwin, jitosname=DARWIN, jitcpuarch=ppc execcapable=1 perl=perl Compiler: cc='gcc -L/sw/lib -I/sw/include', ccflags='-g -pipe -fno-common -no-cpp-precomp -I/usr/local/include -pipe -fno-common -Wno-long-double ', Linker and Libraries: ld='gcc -L/sw/lib -I/sw/include', ldflags='-L/usr/local/lib -flat_namespace ', cc_ldflags='', libs='-lm -lgmp' Dynamic Linking: share_ext='.dylib', ld_share_flags='-dynamiclib', load_ext='.bundle', ld_load_flags='-bundle -undefined suppress' Types: iv=long, intvalsize=4, intsize=4, opcode_t=long, opcode_t_size=4, ptrsize=4, ptr_alignment=1 byteorder=4321, nv=double, numvalsize=8, doublesize=8 --- Environment: DYLD_LIBRARY_PATHHOMELANGLANGUAGELD_LIBRARY_PATHLOGDIR PATHPERL5LIBPERL5_CPANPLUS_CONFIGSHELL -- Alberto Simões - Departamento de Informática - Universidade do Minho Campus de Gualtar - 4710-057 Braga - Portugal
Re: [perl #37876] Bug with Parrot::IO test
Alberto Simoes via RT wrote: We can depend on 3.13 instead of 3.14. From File::Spec Changelog: 3.13 Tue Nov 15 23:50:37 CST 2005 [...] - abs2rel() used to return the empty string when its two arguments were identical, which made no sense. Now it returns curdir(). [Spotted by David Golden] So, maybe we should replace '.' by File::Spec-curdir() but I'm not sure. Yep, I think the attached patch makes more sense. Alberto Parrot Assembler via RT wrote: Greetings, This message has been automatically generated in response to the creation of a parrotbug regarding: Bug with Parrot::IO test There is no need to reply to this message right now. Your ticket has been assigned an ID of [perl #37876]. Please include the string: [perl #37876] In the subject line of all future correspondence about this issue. To do so, you may reply to this message. Thank you, parrotbug https://rt.perl.org/rt3/Ticket/Display.html?id=37876 - Received: (qmail 21338 invoked by alias); 10 Dec 2005 20:37:58 - Received: (qmail 21334 invoked from network); 10 Dec 2005 20:37:58 - Received: from localhost (HELO la.mx.develooper.com) (127.0.0.1) by localhost with SMTP; 10 Dec 2005 20:37:58 - Received: (qmail 21330 invoked by alias); 10 Dec 2005 20:37:58 - Received: from la.mx.develooper.com (HELO x1.develooper.com) (63.251.223.176) by la.mx.develooper.com (qpsmtpd/0.28) with SMTP; Sat, 10 Dec 2005 12:37:51 -0800 Received: (qmail 21290 invoked by uid 225); 10 Dec 2005 20:37:48 - Received: (qmail 21286 invoked by alias); 10 Dec 2005 20:37:47 - Received: from eremita.di.uminho.pt (HELO eremita.di.uminho.pt) (193.136.19.131) by la.mx.develooper.com (qpsmtpd/0.28) with ESMTP; Sat, 10 Dec 2005 12:37:40 -0800 Received: by eremita.di.uminho.pt (Postfix, from userid 1000) id BEC9015704B; Sat, 10 Dec 2005 20:38:45 + (WET) Delivered-To: [EMAIL PROTECTED] Delivered-To: [EMAIL PROTECTED] Delivered-To: [EMAIL PROTECTED] User-Agent: Mutt/1.4.2.1i MIME-Version: 1.0 Subject: Bug with Parrot::IO test X-Spam-Status: No, hits=-2.6 required=8.0 tests=BAYES_00 Return-Path: [EMAIL PROTECTED] X-Spam-Check-BY: la.mx.develooper.com X-Old-Spam-Status: No, hits=-2.6 required=8.0 tests=BAYES_00 Content-Disposition: inline Date: Sat, 10 Dec 2005 20:38:45 + Received-SPF: neutral (x1.develooper.com: local policy) Received-SPF: pass (x1.develooper.com: local policy) X-Old-Spam-Check-BY: la.mx.develooper.com content-type: text/plain; charset=utf-8 Message-ID: [EMAIL PROTECTED] To: [EMAIL PROTECTED] Content-Transfer-Encoding: 8bit From: Alberto Manuel Brandao Simoes [EMAIL PROTECTED] X-RT-Original-Encoding: iso-8859-1 --- osname= darwin osvers= 8.0 arch= darwin-thread-multi-2level cc= cc --- Flags: category=core severity=medium ack=no --- New File::Spec returns '.' if the directory is the same, instead of the old ''. This diff should be in attach, I know, but I still need to learn how to do it, but the diff is very small :-) By the way, if there is a list of dependencies somewhere, File::Spec should be added with version 3.14 Index: t/perl/Parrot_IO.t === --- t/perl/Parrot_IO.t (revision 10433) +++ t/perl/Parrot_IO.t (working copy) @@ -97,7 +97,7 @@ ok($f1 $f2, 'file_with_name'); # Relative paths. -is($d-relative_path($d-path), '', 'relative_path same dir'); +is($d-relative_path($d-path), '.', 'relative_path same dir'); is($d1-relative_path($f1-path), 'file1.txt', 'relative_path same file'); is($d-relative_path($d1-path), 'one', 'relative_path down to dir'); is($d-relative_path($f1-path), catfile(qw(one file1.txt)), --- Summary of my parrot 0.4.0 (r10432) configuration: configdate='Sat Dec 10 19:56:11 2005' Platform: osname=darwin, archname=darwin-thread-multi-2level jitcapable=1, jitarchname=ppc-darwin, jitosname=DARWIN, jitcpuarch=ppc execcapable=1 perl=perl Compiler: cc='gcc -L/sw/lib -I/sw/include', ccflags='-g -pipe -fno-common -no-cpp-precomp -I/usr/local/include -pipe -fno-common -Wno-long-double ', Linker and Libraries: ld='gcc -L/sw/lib -I/sw/include', ldflags='-L/usr/local/lib -flat_namespace ', cc_ldflags='', libs='-lm -lgmp' Dynamic Linking: share_ext='.dylib', ld_share_flags='-dynamiclib', load_ext='.bundle', ld_load_flags='-bundle -undefined suppress' Types: iv=long, intvalsize=4, intsize=4, opcode_t=long, opcode_t_size=4, ptrsize=4, ptr_alignment=1 byteorder=4321, nv=double, numvalsize=8, doublesize=8 --- Environment: DYLD_LIBRARY_PATHHOMELANGLANGUAGELD_LIBRARY_PATHLOGDIR PATHPERL5LIBPERL5_CPANPLUS_CONFIGSHELL -- Alberto Simões - Departamento de Informática - Universidade do Minho Campus de Gualtar - 4710-057 Braga
[perl #37876] Bug with Parrot::IO test
# New Ticket Created by Alberto Manuel Brandao Simoes # Please include the string: [perl #37876] # in the subject line of all future correspondence about this issue. # URL: https://rt.perl.org/rt3/Ticket/Display.html?id=37876 --- osname= darwin osvers= 8.0 arch= darwin-thread-multi-2level cc= cc --- Flags: category=core severity=medium ack=no --- New File::Spec returns '.' if the directory is the same, instead of the old ''. This diff should be in attach, I know, but I still need to learn how to do it, but the diff is very small :-) By the way, if there is a list of dependencies somewhere, File::Spec should be added with version 3.14 Index: t/perl/Parrot_IO.t === --- t/perl/Parrot_IO.t (revision 10433) +++ t/perl/Parrot_IO.t (working copy) @@ -97,7 +97,7 @@ ok($f1 $f2, 'file_with_name'); # Relative paths. -is($d-relative_path($d-path), '', 'relative_path same dir'); +is($d-relative_path($d-path), '.', 'relative_path same dir'); is($d1-relative_path($f1-path), 'file1.txt', 'relative_path same file'); is($d-relative_path($d1-path), 'one', 'relative_path down to dir'); is($d-relative_path($f1-path), catfile(qw(one file1.txt)), --- Summary of my parrot 0.4.0 (r10432) configuration: configdate='Sat Dec 10 19:56:11 2005' Platform: osname=darwin, archname=darwin-thread-multi-2level jitcapable=1, jitarchname=ppc-darwin, jitosname=DARWIN, jitcpuarch=ppc execcapable=1 perl=perl Compiler: cc='gcc -L/sw/lib -I/sw/include', ccflags='-g -pipe -fno-common -no-cpp-precomp -I/usr/local/include -pipe -fno-common -Wno-long-double ', Linker and Libraries: ld='gcc -L/sw/lib -I/sw/include', ldflags='-L/usr/local/lib -flat_namespace ', cc_ldflags='', libs='-lm -lgmp' Dynamic Linking: share_ext='.dylib', ld_share_flags='-dynamiclib', load_ext='.bundle', ld_load_flags='-bundle -undefined suppress' Types: iv=long, intvalsize=4, intsize=4, opcode_t=long, opcode_t_size=4, ptrsize=4, ptr_alignment=1 byteorder=4321, nv=double, numvalsize=8, doublesize=8 --- Environment: DYLD_LIBRARY_PATHHOMELANGLANGUAGELD_LIBRARY_PATHLOGDIR PATHPERL5LIBPERL5_CPANPLUS_CONFIGSHELL -- Alberto Simões - Departamento de Informática - Universidade do Minho Campus de Gualtar - 4710-057 Braga - Portugal
Re: [perl #37876] Bug with Parrot::IO test
On Sat, Dec 10, 2005 at 09:07:50PM +, Alberto Sim??es wrote: Alberto Simoes via RT wrote: We can depend on 3.13 instead of 3.14. From File::Spec Changelog: 3.13 Tue Nov 15 23:50:37 CST 2005 [...] - abs2rel() used to return the empty string when its two arguments were identical, which made no sense. Now it returns curdir(). [Spotted by David Golden] So, maybe we should replace '.' by File::Spec-curdir() but I'm not sure. Yep, I think the attached patch makes more sense. I think we need to also change Parrot::IO::Directory-relative_path() to filter out '' and replace it with '.' or else we'll have to bundle a recent version of File::Spec with Parrot, which I'm not too enthusiastic about. A revised patch is attached. I'll commit it in this form unless there is an objection. Cheers, -J -- Index: lib/Parrot/IO/Directory.pm === --- lib/Parrot/IO/Directory.pm (revision 10434) +++ lib/Parrot/IO/Directory.pm (working copy) @@ -161,7 +161,13 @@ $path = $path-path if ref $path; - return File::Spec-abs2rel($path, $self-path); + my $rel_path = File::Spec-abs2rel($path, $self-path); + +# some (all?) versions of File::Spec-abs2rel() prior to 3.13 return '' +# instead of '.' to indicate the current working directory. In order to be +# compatible with both pre/post version 3.13 we're normalizing the current +# working dir to be '.'. +return $rel_path ? $rel_path : '.'; } =item Cparent() Index: t/perl/Parrot_IO.t === --- t/perl/Parrot_IO.t (revision 10434) +++ t/perl/Parrot_IO.t (working copy) @@ -97,7 +97,7 @@ ok($f1 $f2, 'file_with_name'); # Relative paths. -is($d-relative_path($d-path), '', 'relative_path same dir'); +is($d-relative_path($d-path), curdir(), 'relative_path same dir'); is($d1-relative_path($f1-path), 'file1.txt', 'relative_path same file'); is($d-relative_path($d1-path), 'one', 'relative_path down to dir'); is($d-relative_path($f1-path), catfile(qw(one file1.txt)), pgpljDabNTEAM.pgp Description: PGP signature
Re: [perl #37876] Bug with Parrot::IO test
On Sat, 2005-12-10 at 12:52 -1000, Joshua Hoblitt wrote: I think we need to also change Parrot::IO::Directory-relative_path() to filter out '' and replace it with '.' or else we'll have to bundle a recent version of File::Spec with Parrot, which I'm not too enthusiastic about. A revised patch is attached. I'll commit it in this form unless there is an objection. Seems reasonable to me, unless curdir() can ever return 0 or undef, and also fixes my bug #37875. -- c
Re: [perl #37876] Bug with Parrot::IO test
On Sat, Dec 10, 2005 at 03:04:09PM -0800, chromatic wrote: On Sat, 2005-12-10 at 12:52 -1000, Joshua Hoblitt wrote: I think we need to also change Parrot::IO::Directory-relative_path() to filter out '' and replace it with '.' or else we'll have to bundle a recent version of File::Spec with Parrot, which I'm not too enthusiastic about. A revised patch is attached. I'll commit it in this form unless there is an objection. Seems reasonable to me, unless curdir() can ever return 0 or undef, and also fixes my bug #37875. We could explicitly test if the return eq '' which would let 0 through but it would still filter out undef. I supposed it's possible that the current dir might be named 0. ;) Revised patch is attached. Cheers, -J -- Index: lib/Parrot/IO/Directory.pm === --- lib/Parrot/IO/Directory.pm (revision 10434) +++ lib/Parrot/IO/Directory.pm (working copy) @@ -161,7 +161,13 @@ $path = $path-path if ref $path; - return File::Spec-abs2rel($path, $self-path); + my $rel_path = File::Spec-abs2rel($path, $self-path); + +# some (all?) versions of File::Spec-abs2rel() prior to 3.13 return '' +# instead of '.' to indicate the current working directory. In order to be +# compatible with both pre/post version 3.13 we're normalizing the current +# working dir to be '.'. +return ($rel_path eq '') ? '.' : $rel_path; } =item Cparent() Index: t/perl/Parrot_IO.t === --- t/perl/Parrot_IO.t (revision 10434) +++ t/perl/Parrot_IO.t (working copy) @@ -97,7 +97,7 @@ ok($f1 $f2, 'file_with_name'); # Relative paths. -is($d-relative_path($d-path), '', 'relative_path same dir'); +is($d-relative_path($d-path), curdir(), 'relative_path same dir'); is($d1-relative_path($f1-path), 'file1.txt', 'relative_path same file'); is($d-relative_path($d1-path), 'one', 'relative_path down to dir'); is($d-relative_path($f1-path), catfile(qw(one file1.txt)), pgpi1b1afmKZ7.pgp Description: PGP signature
Re: [perl #37876] Bug with Parrot::IO test
On Sat, Dec 10, 2005 at 03:04:09PM -0800, chromatic wrote: Seems reasonable to me, unless curdir() can ever return 0 or undef, and also fixes my bug #37875. It there something 'magical' about 37875? RT won't let me view it. -- RT Error No permission to view ticket -- -J -- pgpL6NIcFyHtm.pgp Description: PGP signature
Re: [perl #37876] Bug with Parrot::IO test
Awww, I bet you meant bug #37865. #37876 is clearly a duplicate so I'm going to merge #37876 into #37865. -J -- On Sat, Dec 10, 2005 at 02:48:25PM -1000, Joshua Hoblitt wrote: On Sat, Dec 10, 2005 at 03:04:09PM -0800, chromatic wrote: Seems reasonable to me, unless curdir() can ever return 0 or undef, and also fixes my bug #37875. It there something 'magical' about 37875? RT won't let me view it. -- RT Error No permission to view ticket -- -J -- pgpvpq7ytiBP3.pgp Description: PGP signature
Re: [perl #37876] Bug with Parrot::IO test
On Sat, Dec 10, 2005 at 01:21:27PM -1000, Joshua Hoblitt wrote: On Sat, Dec 10, 2005 at 03:04:09PM -0800, chromatic wrote: Seems reasonable to me, unless curdir() can ever return 0 or undef, and also fixes my bug #37875. We could explicitly test if the return eq '' which would let 0 through but it would still filter out undef. I supposed it's possible that the current dir might be named 0. ;) Revised patch is attached. I decided to allow undef to pass through as well in case File::Spec's behavior changes in the future. -- return (defined $rel_path and $rel_path eq '') ? '.' : $rel_path; -- Committed as r10438. Cheers, -J -- pgpX3GjrXyPaI.pgp Description: PGP signature
[perl #22857] Parrot IO test failures
[EMAIL PROTECTED] - Mon Jun 30 07:15:44 2003]: A further data point: the tests pass if I use IMCC to assemble them, rather than assemble.pl Simon Since assemble.pl is no more, closing this ticket.
Re: Parrot IO fun
On Thu, 30 Oct 2003, Melvin Smith wrote: At 12:09 AM 10/31/2003 +, Nicholas Clark wrote: On Thu, Oct 30, 2003 at 01:54:24AM -0500, Melvin Smith wrote: Parrot fetched its first web page tonight. Its a baby step, but hey... :) Can we do IPv6? snip Some of the changes are pretty simple (like instead of using inet_addr, use inet_aton, etc.) while I'll not sure about the rest. It's been a while since I did any socket projects but its all coming back pretty fast. :) Speaking of which, (this version of) Solaris needs -lresolv to use inet_aton; uname -a: SunOS foobar 5.8 Generic_108528-10 sun4u sparc SUNW,Ultra-4 The error: cc -o parrot -L/opt/SUNWspro/WS6/lib -g imcc/main.o blib/lib/libparrot.a -lsocket -lnsl -ldl -lm ild: the archive blib/lib/libparrot.a has entries with the same name -- consistency checks during incremental links are not possible for these entries ild: (undefined symbol) inet_aton -- referenced in the text segment of blib/lib/libparrot.a(io_unix.o) *** Error code 5 make: Fatal error: Command failed for target `parrot' No error if I manually add -lresolv to C_LIBS in the Makefile. -- Dave Isa. 40:31
Re: Parrot IO fun
At 09:16 AM 10/31/2003 -0500, David Robins wrote: On Thu, 30 Oct 2003, Melvin Smith wrote: At 12:09 AM 10/31/2003 +, Nicholas Clark wrote: On Thu, Oct 30, 2003 at 01:54:24AM -0500, Melvin Smith wrote: Parrot fetched its first web page tonight. Its a baby step, but hey... :) Can we do IPv6? snip Some of the changes are pretty simple (like instead of using inet_addr, use inet_aton, etc.) while I'll not sure about the rest. It's been a while since I did any socket projects but its all coming back pretty fast. :) Speaking of which, (this version of) Solaris needs -lresolv to use inet_aton; uname -a: SunOS foobar 5.8 Generic_108528-10 sun4u sparc SUNW,Ultra-4 Thanks for the report. I'll patch it. Time for be to get my old Sun box out of the closet. -Melvin
Re: Parrot IO fun
On Thu, Oct 30, 2003 at 01:54:24AM -0500, Melvin Smith wrote: Parrot fetched its first web page tonight. Its a baby step, but hey... :) You can now stuff hostnames into a socket as well as a numeric IP address. see examples/io/http.imc Can we do IPv6? (Not meant to be a throw away question. As I understand it many hostname functions were changed or tweaked for IPv6, and coping with it now is better than retrofitting it later) Nicholas Clark
Re: Parrot IO fun
On Fri, Oct 31, 2003 at 12:09:14AM +, Nicholas Clark wrote: On Thu, Oct 30, 2003 at 01:54:24AM -0500, Melvin Smith wrote: Parrot fetched its first web page tonight. Its a baby step, but hey... :) I forgot to say: Hey, cool! Nice work. Today web pages, tomorrow self propagating worms? Muahahahaha Nicholas Clark
Re: Parrot IO fun
At 12:09 AM 10/31/2003 +, Nicholas Clark wrote: On Thu, Oct 30, 2003 at 01:54:24AM -0500, Melvin Smith wrote: Parrot fetched its first web page tonight. Its a baby step, but hey... :) You can now stuff hostnames into a socket as well as a numeric IP address. see examples/io/http.imc Can we do IPv6? (Not meant to be a throw away question. As I understand it many hostname functions were changed or tweaked for IPv6, and coping with it now is better than retrofitting it later) Sorry for delay on response, just got to my email. Yes, I intend to encapsulate IPv4 and IPv6 in the same API. Some of the changes are pretty simple (like instead of using inet_addr, use inet_aton, etc.) while I'll not sure about the rest. It's been a while since I did any socket projects but its all coming back pretty fast. :) Luckily I have a very nice C++ library that I wrote over the past few years so a lot of it will be cut and paste and a little rework. -Melvin
Parrot IO fun
Parrot fetched its first web page tonight. Its a baby step, but hey... :) You can now stuff hostnames into a socket as well as a numeric IP address. see examples/io/http.imc -Melvin
Re: cvs commit: parrot/io io.c io_buf.c
Melvin Smith [EMAIL PROTECTED] writes: Did you consider using the method interface in ParrotIO? That ought to be even extensible with user code. Yes, I'm trying to get back up to speed on everything. The method interface is a new feature that I need to look at. I've written a first cut on the method interface in parrotio.pmc. The system is fairly simple: At class_init time the methods are registred in a hash and the find_method function looks up this hash and returns a invoke-able PMC (a NCI). See t/pmc/io.t for example. bye boe -- Juergen Boemmels[EMAIL PROTECTED] Fachbereich Physik Tel: ++49-(0)631-205-2817 Universitaet Kaiserslautern Fax: ++49-(0)631-205-3906 PGP Key fingerprint = 9F 56 54 3D 45 C1 32 6F 23 F6 C7 2F 85 93 DD 47
Re: cvs commit: parrot/io io.c io_buf.c
Melvin Smith [EMAIL PROTECTED] wrote: I personally don't like to add an opcode for every special case because most of them are very rarely used, but as usual its up for discussion. Did you consider using the method interface in ParrotIO? That ought to be even extensible with user code. -Melvin leo
Re: cvs commit: parrot/io io.c io_buf.c
At 09:59 AM 10/11/2003 +0200, Leopold Toetsch wrote: Melvin Smith [EMAIL PROTECTED] wrote: I personally don't like to add an opcode for every special case because most of them are very rarely used, but as usual its up for discussion. Did you consider using the method interface in ParrotIO? That ought to be even extensible with user code. Yes, I'm trying to get back up to speed on everything. The method interface is a new feature that I need to look at. -Melvin
Re: cvs commit: parrot/io io.c io_buf.c
At 11:23 PM 10/10/2003 +0100, Nicholas Clark wrote: On Fri, Oct 10, 2003 at 05:55:11PM -0400, Melvin Smith wrote: Which ones? The PIOCTL ones are, for a lack of current interface, a way for interfacing to the lower level IO system through a catchall opcode. It can be anything from setting terminal modes, buffering, separator characters, the list goes on. Sorry. Wasn't clear. The PIOCTL macros are (to me) the correct way of doing something. -6 and -3 are magic numbers. They have no context as to what they might be. Eep, I misread it, you were clear. That was just debugging I left in. Have we defined the standard way for error reporting in Parrot. At one time we had talked of having an errno for each interpreter? Maybe now is the time to standardize it. -Melvin
Re: cvs commit: parrot/io io.c io_buf.c
Which ones? The PIOCTL ones are, for a lack of current interface, a way for interfacing to the lower level IO system through a catchall opcode. It can be anything from setting terminal modes, buffering, separator characters, the list goes on. Although we probably want to make separate ops for common things like setting blocking mode, async/sync, etc. there are usually a lot of little operations or queries that you might want to do on an IO system that might not warrant a separate op for each. I personally don't like to add an opcode for every special case because most of them are very rarely used, but as usual its up for discussion. -Melvin At 04:46 PM 10/10/2003 +0100, Nicholas Clark wrote: On Fri, Oct 10, 2003 at 02:43:10AM -, Melvin Smith wrote: +else if(arg == PIOCTL_BLKBUF) { + PIO_setbuf(interpreter, pmc, PIO_UNBOUND); + return 0; +} +else return -3; case PIOCTL_CMDGETBUFSIZE: if(b) return b-size; else return -6; What are all these magic numbers about? Nicholas Clark
Re: cvs commit: parrot/io io.c io_buf.c
On Fri, Oct 10, 2003 at 05:55:11PM -0400, Melvin Smith wrote: Which ones? The PIOCTL ones are, for a lack of current interface, a way for interfacing to the lower level IO system through a catchall opcode. It can be anything from setting terminal modes, buffering, separator characters, the list goes on. Sorry. Wasn't clear. The PIOCTL macros are (to me) the correct way of doing something. -6 and -3 are magic numbers. They have no context as to what they might be. At 04:46 PM 10/10/2003 +0100, Nicholas Clark wrote: On Fri, Oct 10, 2003 at 02:43:10AM -, Melvin Smith wrote: +else if(arg == PIOCTL_BLKBUF) { + PIO_setbuf(interpreter, pmc, PIO_UNBOUND); + return 0; +} +else return -3; case PIOCTL_CMDGETBUFSIZE: if(b) return b-size; else return -6; What are all these magic numbers about? Nicholas Clark Nicholas Clark
Re: cvs commit: parrot/io io.c io_buf.c
On Fri, Oct 10, 2003 at 02:43:10AM -, Melvin Smith wrote: +else if(arg == PIOCTL_BLKBUF) { + PIO_setbuf(interpreter, pmc, PIO_UNBOUND); + return 0; +} +else return -3; case PIOCTL_CMDGETBUFSIZE: if(b) return b-size; else return -6; What are all these magic numbers about? Nicholas Clark
Re: [perl #22854] Incongruity in Parrot IO and/or Parrot I/O crashes on STDIN read
.sub _main fdopen $P1, 0, r # STDIN BTW fdopen $P1, 0, # read STDIN 3. its currently only defined for PIO_OS_UNIX Okaaay, so the plan is for this to work and I should probably code this way anyway, right? You could just delete the #ifdef PIO_OS_UNIX in io.ops:fdopen and see, if its working. Given Jürgen's patch to completely remove the integer file descriptors and to add the getstdin, getstdout, and getstderr I think this bug can be dropped. fdopen() isn't completely functional under Win32 (either that, or I blew the part where I expose the Unix interface) but this should take care of most fd problems in Win32. (I don't think I've *ever* seen a Windows program pass a file descriptor...) Given that, there's a possible bug in Jürgen's patch (or IMCC?). Given: .sub _main call _INIT .arg 0 call _READLINE .result $S0 print $S0 end .end .sub _INIT $P0=new PerlArray # Array of BASIC FD's getstdin $P1# traditional #0 defined $I0, $P1 unless $I0, err $P0[0]=$P1 getstdout $P1 # traditional #1, etc... $P0[1]=$P1 defined $I0, $P1 unless $I0, err store_global FDS, $P0 ret err:print Cannot get handle for STDIN end .end .sub _READLINE # string readline(int fd) saveall .param int fd find_global $P0, FDS $P1=$P0[fd] set $S0, read $S0, $P1, 255 # -- Crunch .return $S0 restoreall ret .end This produces the PASM: _main: bsr _INIT save 0 bsr _READLINE restore S0 print S0 end _INIT: new P1, 19 # .PerlArray getstdin P0 defined I0, P0 unless I0, err set P1[0], P0 getstdout P0# -- bug is here? Overwrote my P0. set P1[1], P0 store_global FDS, P1 ret err: print Cannot get handle for STDIN end _READLINE: saveall restore I0 find_global P0, FDS set P0, P0[I0] set S0, read S0, P0, 255 save S0 restoreall ret Given that I'm just taking STDIN, STDOUT, STDERR and trying to stuff them into an array, should I have to use three different registers for this in the PIR? new $P4, PerlArray getstdin $P0 getstdout $P1 getstderr $P2 $P4[0], $P0 $P4[1], $P1 $P4[2], $P2 Or should getstdin/out/err have not overwritten the Px register and given up a new one each time? Either behavior is fine, so long as we're consistant and/or documented.
Re: [perl #22854] Incongruity in Parrot IO and/or Parrot I/O crashes on STDIN read
Clinton Pierce wrote: set P1[0], P0 getstdout P0# -- bug is here? Overwrote my P0. set P1[1], P0 Yep a bug is here. But this bug is a BASIC compiler bug. Things that go into aggregates (or are stored in lex pads/global tables) are stored by reference. You have to clone PMCs to get independed vars: .sub _main $P0 = new PerlArray $P1 = new PerlString $P1 = ok\n $P0[0] = $P1 $P1 = no\n $P0[1] = $P1 $P2 = $P0[0] $P3 = $P0[1] print $P2 print $P3 end .end $ parrot pierce.imc no no leo
Re: [perl #22854] Incongruity in Parrot IO and/or Parrot I/O crashes on STDIN read
Clinton Pierce [EMAIL PROTECTED] writes: Given that, there's a possible bug in Jürgen's patch (or IMCC?). Given: .sub _main call _INIT .arg 0 call _READLINE .result $S0 print $S0 end .end .sub _INIT $P0=new PerlArray # Array of BASIC FD's getstdin $P1# traditional #0 defined $I0, $P1 unless $I0, err $P0[0]=$P1 getstdout $P1 # traditional #1, etc... $P0[1]=$P1 defined $I0, $P1 unless $I0, err store_global FDS, $P0 ret err: print Cannot get handle for STDIN end .end .sub _READLINE # string readline(int fd) saveall .param int fd find_global $P0, FDS $P1=$P0[fd] set $S0, read $S0, $P1, 255# -- Crunch .return $S0 restoreall ret .end What is that supposed to do? As I understand it it reads a line from stdin and writes it to standard out. A short test of this code simply worked. If it does not work for you, can you send me a parrot -t of this code? This produces the PASM: _main: bsr _INIT save 0 bsr _READLINE restore S0 print S0 end _INIT: new P1, 19 # .PerlArray getstdin P0 defined I0, P0 unless I0, err set P1[0], P0 getstdout P0 # -- bug is here? Overwrote my P0. Overwriting P0 is not a problem here. You don't use it any more. Overwriting P1[0] would be a problem, but this should not be the case because getstd* create always a new PMC. set P1[1], P0 store_global FDS, P1 ret err: print Cannot get handle for STDIN end _READLINE: saveall restore I0 find_global P0, FDS set P0, P0[I0] set S0, read S0, P0, 255 save S0 restoreall ret Either behavior is fine, so long as we're consistant and/or documented. getstd* Px don't change the value of the old Px, but changing the pointer to a new PMC. Its like set P0, P1 and not like assign P0, P1 bye boe -- Juergen Boemmels[EMAIL PROTECTED] Fachbereich Physik Tel: ++49-(0)631-205-2817 Universitaet Kaiserslautern Fax: ++49-(0)631-205-3906 PGP Key fingerprint = 9F 56 54 3D 45 C1 32 6F 23 F6 C7 2F 85 93 DD 47
Re: [perl #22854] Incongruity in Parrot IO and/or Parrot I/O crashes on STDIN read
Typo! getstderr P3 # STDOUT Should have been getstdout Although... if left at getstderr the error also goes away. (Add that to my bullet list.) My haven't-grokked-the-code psychic abilities tell me that getstdout does something Real Bad to the stdout filehandle and any later uses of it (with print?) cause segfaults.
Re: [perl #22854] Incongruity in Parrot IO and/or Parrot I/O crashes on STDIN read
Clinton Pierce wrote: What I do know is that imcc -t under Win32 is crash-happy Snippet runs fine on Linux (with typo adjusted or not) as well as your previous one, -t or not. But, as IO is under *construction* some issues might remain. They'll get resolved. leo
Re: [perl #22857] Parrot IO test failures
Leopold Toetsch [EMAIL PROTECTED] writes: Simon Glover [EMAIL PROTECTED] wrote: I'm getting failures in tests 1 2 in t/pmc/io.t; however, both tests seem to run fine if I run them in the debugger. valgrind does indicate, that there are unitialized items in many parts of io_buf.c. Can you tell me more about this. I know some parts code, but I still did not manage to get valgrind running on my mashine. (I don't know, if these tests even should use the bufferd IO layer, but there is for sure something wrong there) At the moment the default is to use the buffered IO. The pushing and popping of IO-Layers did not already made it to io.ops. The arbitrary failures come from uninitialized memory. I try to look into this. boe -- Juergen Boemmels[EMAIL PROTECTED] Fachbereich Physik Tel: ++49-(0)631-205-2817 Universitaet Kaiserslautern Fax: ++49-(0)631-205-3906 PGP Key fingerprint = 9F 56 54 3D 45 C1 32 6F 23 F6 C7 2F 85 93 DD 47
Re: [perl #22854] Incongruity in Parrot IO and/or Parrot I/O crashes on STDIN read
Clinton A. Pierce (via RT) wrote: Suggestions welcome! First, always check the result of IO operations. If something fails, these return a PerlUndef, so: .sub _main fdopen $P1, 0, r # STDIN defined $I0, $P1 unless $I0, err read $S0, $P1, 255 print $S0 end err: print fdopen failed\n end .end 2. Cfdopen was disabled totally due to a wrong #ifdef 3. its currently only defined for PIO_OS_UNIX 4. Thanks again for your really valuable bug reports. leo
Re: [perl #22854] Incongruity in Parrot IO and/or Parrot I/O crashes on STDIN read
First, always check the result of IO operations. If something fails, these return a PerlUndef, so: .sub _main fdopen $P1, 0, r # STDIN defined $I0, $P1 *Doh* Stupid Newbie Error. unless $I0, err read $S0, $P1, 255 print $S0 end err: print fdopen failed\n end .end 2. Cfdopen was disabled totally due to a wrong #ifdef 3. its currently only defined for PIO_OS_UNIX Okaaay, so the plan is for this to work and I should probably code this way anyway, right?
Re: [perl #22854] Incongruity in Parrot IO and/or Parrot I/O crashes on STDIN read
Clinton Pierce [EMAIL PROTECTED] wrote: .sub _main fdopen $P1, 0, r # STDIN BTW fdopen $P1, 0, # read STDIN 3. its currently only defined for PIO_OS_UNIX Okaaay, so the plan is for this to work and I should probably code this way anyway, right? You could just delete the #ifdef PIO_OS_UNIX in io.ops:fdopen and see, if its working. leo
[perl #22857] Parrot IO test failures
# New Ticket Created by Simon Glover # Please include the string: [perl #22857] # in the subject line of all future correspondence about this issue. # URL: http://rt.perl.org/rt2/Ticket/Display.html?id=22857 Hi, I'm getting failures in tests 1 2 in t/pmc/io.t; however, both tests seem to run fine if I run them in the debugger. Furthermore, running test 1 on the command line, I find that for plain ./parrot and for ./parrot -g the test fails; for ./parrot -P and ./parrot -S, it succeeds; and for ./parrot -j, it succeeds and then segfaults. I have no idea what's going on here. Simon
Re: [perl #22857] Parrot IO test failures
A further data point: the tests pass if I use IMCC to assemble them, rather than assemble.pl Simon
Re: [perl #22857] Parrot IO test failures
Simon Glover [EMAIL PROTECTED] wrote: I'm getting failures in tests 1 2 in t/pmc/io.t; however, both tests seem to run fine if I run them in the debugger. valgrind does indicate, that there are unitialized items in many parts of io_buf.c. (I don't know, if these tests even should use the bufferd IO layer, but there is for sure something wrong there) The arbitrary failures come from uninitialized memory. Simon leo
[perl #22854] Incongruity in Parrot IO and/or Parrot I/O crashes on STDIN read
# New Ticket Created by Clinton A. Pierce # Please include the string: [perl #22854] # in the subject line of all future correspondence about this issue. # URL: http://rt.perl.org/rt2/Ticket/Display.html?id=22854 This is either an oversight in the current implementation *or* its a bug. Or both. Bug described is on Win32. To read a line of input: readline Sx, Ix Switches to line buffered mode and reads from fd Ix. This works great: readline $S0, 0 print $S0 But is the old, deprecated way of doing things. As a matter of fact, it's nigh impossible now to open an FD to a file and do anything useful with it as enough bits of the old way of doing things are dismantled now... So, I'm trying to use the new ParrotIO stuff, and according to it I should get a ParrotIO object for STDIN: fdopen $P1, 0, r And then use the read Sx, Px, Ix function (which on a line-buffered descriptor line STDIN, should stop at EOL): read $S0, $P1, 255 This crashes: .sub _main fdopen $P1, 0, r # STDIN read $S0, $P1, 255 print $S0 end .end Suggestions welcome!
Re: cvs commit: parrot/io io.c
Readded the pio_(stdin|stdout|stderr) to make builds work again. I moved stdin/stdout/stderr to be interp local so you can use: interpreter-piodata-table[PIO_STDIN_FILENO], etc. now. Those global pointers should go away because they are null now anyway. -Melvin Revision ChangesPath 1.11 +5 -5 parrot/jit.c Index: jit.c === RCS file: /home/perlcvs/parrot/jit.c,v retrieving revision 1.10 retrieving revision 1.11 diff -u -w -r1.10 -r1.11 --- jit.c 20 Jan 2002 20:52:21 - 1.10 +++ jit.c 28 Jan 2002 14:16:59 - 1.11 @@ -1,7 +1,7 @@ /* ** jit.c ** -** $Id: jit.c,v 1.10 2002/01/20 20:52:21 grunblatt Exp $ +** $Id: jit.c,v 1.11 2002/01/28 14:16:59 grunblatt Exp $ */ #include parrot/parrot.h @@ -33,7 +33,7 @@ INTVAL *address,ivalue,size,i,k; INTVAL *op_address, prev_address, bytecode_position; #ifdef ALPHA -char *interpreter_registers = ((char *)interpreter-int_reg-registers[0]) + 0x7fff; +char *interpreter_registers = ((char *)interpreter-int_reg.registers[0]) + 0x7fff; INTVAL high,low; #endif @@ -107,7 +107,7 @@ v = op_assembly[*pc].intval_register_address; for (i = 0; i v.amount; i++) { -address = interpreter-int_reg-registers[pc[v.info[i].number]]; +address = interpreter-int_reg.registers[pc[v.info[i].number]]; #ifdef ALPHA address = (INTVAL*)(((char *)address) - interpreter_registers); #endif @@ -117,7 +117,7 @@ v = op_assembly[*pc].floatval_register_address; for (i = 0; i v.amount; i++) { -address = (INTVAL *)interpreter-num_reg-registers[pc[v.info[i].number]]; +address = (INTVAL *)interpreter-num_reg.registers[pc[v.info[i].number]]; #ifdef ALPHA address = (INTVAL*)(((char *)address) - interpreter_registers); #endif @@ -129,7 +129,7 @@ v = op_assembly[*pc].string_register_address; for (i = 0; i v.amount; i++) { -address = (INTVAL *)interpreter-string_reg-registers[pc[v.info[i].number]]; +address = (INTVAL *)interpreter-string_reg.registers[pc[v.info[i].number]]; #ifdef ALPHA address = (INTVAL*)(((char *)address) - interpreter_registers); #endif 1.12 +6 -1 parrot/io/io.c Index: io.c === RCS file: /home/perlcvs/parrot/io/io.c,v retrieving revision 1.11 retrieving revision 1.12 diff -u -w -r1.11 -r1.12 --- io.c 28 Jan 2002 04:27:17 - 1.11 +++ io.c 28 Jan 2002 14:17:05 - 1.12 @@ -1,7 +1,7 @@ /* io.c * Copyright: (When this is determined...it will go here) * CVS Info - * $Id: io.c,v 1.11 2002/01/28 04:27:17 mrjoltcola Exp $ + * $Id: io.c,v 1.12 2002/01/28 14:17:05 grunblatt Exp $ * Overview: * This is the Parrot IO subsystem API. Generic IO stuff * goes here, each specific layer goes in its own file... @@ -29,6 +29,11 @@ /* ParrotIOLayer * pio_default_stack; */ + +/* The standard streams */ +ParrotIO * pio_stdin; +ParrotIO * pio_stdout; +ParrotIO * pio_stderr; PIOOFF_Tpiooffsetzero;