Re: [perl #41788] [BUG] Real registers are limited to 2 digits

2008-12-01 Thread NotFound
> Currently, IMCC still has a 2-digit limit for PASM registers.
> I think we can easily extend this to any number, as long as it fits in
> an INTVAL.

Last time I checked, register allocator and some other imcc parts used
unsigned char for register numbers in several places.

-- 
Salu2


[perl #60946] [BUG] cannot override isa() if PIR uses isa opcode

2008-12-01 Thread via RT
# New Ticket Created by  Chris Dolan 
# Please include the string:  [perl #60946]
# in the subject line of all future correspondence about this issue. 
# http://rt.perl.org/rt3/Ticket/Display.html?id=60946 >


I'm trying to make mock objects in Rakudo, but the 'isa' opcode in  
PIR seems to ignore my overridden isa() method.  The attached code  
sample demonstrates the problem by:

1) creating a mock class that overrides isa()
2) calling .WHAT to ensure I built the right class
3) calling .isa to show that the mock works
4) invokes the isa opcode in PIR to test that the mock acts like the  
mocked class

Expected result: step 4 returns true, just like step 3
Actual result: step 4 returns false

The last step shows that PIR is not fooled by the mock class.  I  
worry that this scenario will cause UNIVERSAL::isa problems all over  
again.  I expect that the same problem will arise from the 'can' opcode.

use v6;
class Mock::PGE::Match {
   method isa($x) {
  return $x === PGE::Match || self.HOW.isa(self, $x);
   }
   # ...
}

my $m = Mock::PGE::Match.new;
say 'What: ' ~ $m.WHAT;
say 'm.isa(PGE::Match): ' ~ $m.isa(PGE::Match);
# Hack to embed PIR:
'a' ~~ /{{
get_hll_global $P0, ["Mock";"PGE"], "Match"
$P1 = $P0."new"()
$I0 = isa $P1, ["PGE";"Match"]
$S0 = $I0
$S1 = "PIR opcode isa [PGE;Match]: "
$S2 = concat $S1, $S0
say $S2
}}/


Parrot Bug Summary

2008-12-01 Thread Parrot Bug Summary
Parrot Bug Summary

http://rt.perl.org/rt3/NoAuth/parrot/Overview.html
Generated at Mon Dec 1 14:00:01 2008 GMT
---

  * Numbers
  * New Issues
  * Overview of Open Issues
  * Ticket Status By Version
  * Requestors with most open tickets

---

Numbers

Ticket Counts: 36 new + 552 open = 588
Created this week: 3
Closed this week: 34

---

New Issues

New issues that have not been responded to yet

1 - 2 weeks old
60658 Broken links to Glossary and Patch & Bug Report Submission Information
60652 Lexicals and :outer not Thawed Properly from PBC
60650 Lexical Associations Not Thawed with Tailcalls
60640 Exception Handlers won't automatically be disabled
60632 [TODO] codingstd: No line splitting in CONST_STRING
2 - 3 weeks old
60608 [PATCH] Fix install when libdir is different from "$prefix/lib"
60590 Bytecode packfile segment will use subid not sub name
60578 parrot.org: add link for reporting problems to each page
3 - 4 weeks old
60338 [BUG] NCI segfaults with null pcc_params_signature
4 - 5 weeks old
60206 [BUG] [MMD] Segfault in Lua exception handler
5 - 6 weeks old
6 - 7 weeks old
59978 [TODO] Add SVN revision number of reports to Smolder front page
7 - 8 weeks old
59696 [TODO] Unimplemented Unicode Functions
8 - 9 weeks old
9 - 10 weeks old
10 - 11 weeks old
58990 [TODO] Design new spec coverage mechanism
11 - 12 weeks old
58740 [CAGE] t/configure/*.t and t/steps/*.t: Cleanup test setup/teardown code 
12 - 13 weeks old
58672 [TODO] implement method lookup iterators
58670 Parrot_print_backtrace() depends on __USE_GNU
58668 src/exceptions.c exposes brokenness in make cover
58488 crashing parrot when calling create_lexinfo
13 - 14 weeks old
14 - 15 weeks old
58324 Build issues on WXP
58188 [TODO] Parrot_find_encoding_converter
58070 [RFC] Disallow .local declarations in long-style call statement
15 - 16 weeks old
58050 Segfault in "make testr" for t/compilers/imcc/syn/hll.t:2
16 - 17 weeks old
57680 [CAGE] Problems in find_write_record
57678 [CAGE] Poor Man's Deadlock Detection
57676 [CAGE] Check for shared status of STM handle
17 - 18 weeks old
18 - 19 weeks old
57236 [TODO] pbc_to_exe --install pbc1 [pbc2...]
19 - 20 weeks old
20 - 21 weeks old
56782 [TODO] question in getNameForKey in Getopt::Obj
---

Overview of Open Issues

Platform   Severity   Tag   Lang
aix   0abandoned 05005threads   0   Amber   0
All   1fatal 1bounce0   BASIC   0
bsdos 0High  0Bug  95   bc  0
cygwin2low   1compiler  0   befunge 0
cygwin_nt 0medium1configure 3   bf  0
darwin8none  1core  2   cola0
dec_osf   0Normal1dailybuild0   forth   0
dgux  0unknown   0docs  3   jako0
dos   0Wishlist  3duplicate 0   Lisp0
dynixptx  0  install   2   lolcode 0
freebsd   5   library   0   m4  0
generic   0   notabug   0   ook 0
gnu   0   notok 0   perl6   1
HPUX  0   ok0   plot0
irix  0   Patch30   punie   0
irix640   regex 2   pynie   0
Linux 2   sendToCPAN0   python  0
lynxos0   Todo254   ruby0
mac   0   unknown   0   scheme  0
machten   0   utilities 0   tcl 0
macos 0   wontfix   0   urm 0
MacOS X   8Zcode   0
mswin32   2
netbsd1
next  0
openbsd   1
os2   0
os390 0
other 0
powerux   0
qnx   0
riscos0
sco   0
Solaris   6
sunos 1
svr4  0
svr5  0
sysv  0
unicos0
unicosmk  0
unix  0
unknown   0
uts   0
vms   0
VOS   0
Win32 8
---

Ticket Status By Version

New or OpenResolved

---

Requestors with most open tickets

Paul Cochrane   168
Will Coleda  53
chromatic34
Patrick R. Michaud   31
Jerry Gay21
Mark Glines  16
Klaa

Re: [perl #48445] [TODO] [NQP] - report undeclared variable usage

2008-12-01 Thread Will Coleda
On Mon, Dec 1, 2008 at 9:52 AM, Klaas-Jan Stol via RT
<[EMAIL PROTECTED]> wrote:
> On Thu Jun 26 20:16:45 2008, coke wrote:
>> On Mon Dec 10 11:49:08 2007, pmichaud wrote:
>> >
>> > When an NQP program uses a variable that hasn't been
>> > previously declared, it should report a useful error message:
>> >
>> > Use of undeclared variable '$x' at ...
>> >
>> > Pm
>
> Currently it report this:
>
> C:\[...]\parrot>parrot compilers\nqp\nqp.pbc
>> $x := 1;
> Scope not found for PAST::Var '$x'
>>
>
> Is that good enough?
> Maybe the line can be reported as well?
>
>>
>> Looking at this, there doesn't seem to be a way to write a self-hosted
>> test (in nqp) for this
>> since there's no try/catch equivalent.
>>
>> Can someone add a PIR based TODO test for this (in compilers/nqp/t)
>> that shows the desired
>> (but not yet implemented) behavior?
>
> I'm not sure what is suggested here, or how to do it.
>
>
> kjs

NQP tests are written in NQP: So far as I can tell, there's no way to
catch the error that we want to insure is there. The easiest way I
could think of was to write the test in PIR, where we could invoke
NQP, but wrap the call in an exception handler, make sure it looked
like what we wanted, and then report success.

-- 
Will "Coke" Coleda


Re: [perl #60922] Parrot doesn't distinguish hash access from array access in matches

2008-12-01 Thread Patrick R. Michaud
Just a note that I expect we will fix this when we implement
slicing and the postcircumfix: methods.

Pm


Re: [perl #36330] [TODO] Create a BigNum PMC

2008-12-01 Thread Patrick R. Michaud
On Mon, Dec 01, 2008 at 06:23:31AM -0800, Klaas-Jan Stol via RT wrote:
> On Sat Sep 08 10:39:31 2007, bernhard wrote:
> > Just for the records, Andy Lester wrote on p2:
> > 
> > bignum.c seems to be entirely unused.  Everything builds just fine
> > without it.  There are many lint errors in it, such as int functions
> > returning with "return;" and no value.
> > 
> > Can we throw it away?  Move it somewhere out of the way? 

If (1) bignum.c is not being used, and (2) we don't expect it to 
be used between now and Parrot 1.0, then I recommend we eliminate 
it for the time being.

If someone in the future wants to recover this code as part of
(re)implementing BigInt/BigNum/BigWhatever, they can easily do
so from the svn repository.  Until then, let's not carry around
the code baggage and/or lead coders down false trails.

Pm


Re: [perl #45979] [TODO] Use current namespace as base when nested?

2008-12-01 Thread Patrick R. Michaud
On Mon, Dec 01, 2008 at 10:01:24AM -0800, Klaas-Jan Stol via RT wrote:
> On Tue Oct 02 10:49:05 2007, pcoch wrote:
> > In src/objects.c:parrot_class_register() there is the todo item:
> > 
> > /* XXX nested, use current as base ? */
> > 
> > Which is referring to namespaces.  Make a decision about this and 
> implement
> > as appropriate.
> 
> I can't find the function parrot_class_register in either src/oo.c or 
> src/pmc/object.pmc
> 
> Is this issue still relevant? (I think not).

The issue is still relevant but is probably subsumed by trac #8, so
I think we should reject this ticket and let the issue be addressed 
there.

http://trac.parrot.org/parrot/ticket/8

Pm


Re: [perl #46147] [TODO] Print out more information about the macro in imcc

2008-12-01 Thread Patrick R. Michaud
On Mon, Dec 01, 2008 at 10:07:20AM -0800, Klaas-Jan Stol via RT wrote:
> On Sat Oct 06 03:15:12 2007, pcoch wrote:
> > In compilers/imcc/main.c:do_pre_process() there is the todo item:
> > 
> > /* TODO: print out more information about the macro */
> 
> Is having more information about a macro, in IMCC's preprocessing 
> option, useful, considering that IMCC's preprocessing function is not 
> complete anyway, and IMCC will be replaced in the relatively short run 
> (I'd say, within 1 year)?
> 
> If not, then I propose to reject this ticket.

+1

Pm


Re: [perl #47966] [DOCS] pdd23 doesn't list exception;death as a standard exception

2008-12-01 Thread Patrick R. Michaud
On Mon, Dec 01, 2008 at 10:09:38AM -0800, Klaas-Jan Stol via RT wrote:
> On Sun Nov 30 05:51:34 2008, kjs wrote:
> > On Thu Nov 29 11:35:12 2007, pmichaud wrote:
> > > In the list of "Standard Parrot Exceptions" in pdd23, there's
> > > no item given for "exception;death"  even though it's mentioned
> > > as part of the "die" opcode earlier in the text.
> > > 
> > > The same is true for the "exception;exit" type thrown by the
> > > exit opcode.
> > 
> > Attached is a patch that adds the exception;exit and exception;death 
> > exception types.
> 
> Just a quick note: I accidentally committed the above change myself when 
> adding another change. Ah, it can't hurt. (It might need to be changed.)

... how exactly does one use C, C,
and the other exception types from PIR?  I see them mentioned throughout
pdd23, but I've never actually seen an example of how these constants
(are they constants?) might appear in actual code, whether it's PIR, C, 
or otherwise.

The only "types" I'm aware of for exceptions are the severity values
and exception type values in include/parrot/exceptions.h and
runtime/parrot/include/except_*.pasm, and none of these seem to have
any real correspondence to the "exception types" given in pdd23.

Pm



[perl #60966] wrong data pass

2008-12-01 Thread via RT
# New Ticket Created by  Ruslan 
# Please include the string:  [perl #60966]
# in the subject line of all future correspondence about this issue. 
# http://rt.perl.org/rt3/Ticket/Display.html?id=60966 >


In this code, result will be 123, but i think that it must be 1.


sub test(@test is copy)
{
@test[0] = 123;
};

my @test = (1, 2, 3);
test(@test);

print @test[0];


[perl #60962] [BUG] Can't register multi methods (t/spec/S12-methods/multi.t fails)

2008-12-01 Thread mor...@casella.faui2k3.org (via RT)
# New Ticket Created by  [EMAIL PROTECTED] 
# Please include the string:  [perl #60962]
# in the subject line of all future correspondence about this issue. 
# http://rt.perl.org/rt3/Ticket/Display.html?id=60962 >


Rakudo as of r33417 fails t/spec/S12-methods/default-trait.t and
t/spec/S12-methods/multi.t:

A method named 'bar' already exists in class 'Foo'. It may have been supplied
by a role.
current instr.: '!TOPERL6MULTISUB' pc 13534 (src/gen_builtins.pir:8162)

All Perl 6 level multi methods seem to suffer from this problem.
Moritz


[perl #60964] racudo hungup after parse

2008-12-01 Thread via RT
# New Ticket Created by  Ruslan 
# Please include the string:  [perl #60964]
# in the subject line of all future correspondence about this issue. 
# http://rt.perl.org/rt3/Ticket/Display.html?id=60964 >


On winXp(SP3) on this test i have racudo hungup:


how to write literals of some Perl 6 types?

2008-12-01 Thread Darren Duncan

Hello,

I'm wondering how to write anonymous value literals of some Perl 6 basic types, 
and I didn't see mention of this in synopsis 2.


Now, with some basic types, I know how to do it, examples:

  Bool # Bool::True
  Int  # 42 or 0x17 or :12
  Rat|Num  # 18.2 or :8<53.07> or 4/3
  Str  # 'Hello world'
  Pair # :key or key=>val
  Range# 1..10
  Junction # 'a'|'b'|'c' or 'e'&'f' or any(5,20) or none(60,87)
  Seq  # (5,6,7)
  Array# [8,9,10]
  Hash # { :a, :c } or { a => 'b', c => 'd' }

Correct me if I'm wrong with the above.

But some significant ones I don't know and really want to know:

  Bit
  Blob
  Set
  Bag
  Mapping

How does one write anonymous value literals of those types?  And I mean 
directly, not by writing a literal of some other type and using a conversion 
function to derive the above?


The above is my main question, but also I wonder about how to make an anonymous 
literal of a KeyHash|KeySet|KeyBag.  And also how does one specify a Rat vs a 
Num or what does "18.2" or "4/3" actually get you?  And also is there such a 
thing as a Buf literal and if so how do you write one?


Thank you. -- Darren Duncan


Re: [perl #60964] racudo hungup after parse

2008-12-01 Thread ruslan usifov
I'm sorry, that is:

sub test(@test is copy, $as)
{
@test[0] = 123;
};

my @test = (1, 2, 3, 4);
test(@test);

print @test[0];



After that perl6.exe will produce:

too few arguments passed (1) - 2 params expected
current instr.: 'test' pc 162 (EVAL_13:64)
called from Sub '_block11' pc 85 (EVAL_13:31)
called from Sub 'parrot;PCT;HLLCompiler;eval' pc 892
(src\PCT\HLLCompiler.pir:50
8)
called from Sub 'parrot;PCT;HLLCompiler;evalfiles' pc 1227
(src\PCT\HLLCompiler.
pir:674)
called from Sub 'parrot;PCT;HLLCompiler;command_line' pc 1403
(src\PCT\HLLCompil
er.pir:762)
called from Sub 'parrot;Perl6;Compiler;main' pc 16408 (perl6.pir:168)



and hung up


2008/12/2 Moritz Lenz via RT <[EMAIL PROTECTED]>

> On Mon Dec 01 04:50:03 2008, tantra wrote:
> > On winXp(SP3) on this test i have racudo hungup:
>
> Which test?
>
> Moritz
>
>


[perl #60976] [PATCH] rakudo fails to build AST for subset declaration with regex literal

2008-12-01 Thread gabriele renzi
# New Ticket Created by  "gabriele renzi" 
# Please include the string:  [perl #60976]
# in the subject line of all future correspondence about this issue. 
# http://rt.perl.org/rt3/Ticket/Display.html?id=60976 >


The bug is visibile with the following line

subset GenderStr of Str where /^[m|f]$/ ;

for what I can tell the problem is due to the code to manage
type_declarator that only checks if a EXPR is a PAST::Block.
A regex is recognized as a block but it lacks some of the structure so
I get this error:

.Method 'push' not found for invocant of class 'Perl6;Grammar'
current instr.: 'parrot;Perl6;Grammar;Actions;_block5542' pc 141736
(src/gen_actions.pir:15745)
called from Sub 'parrot;Perl6;Grammar;Actions;_block5532' pc 141655
(src/gen_actions.pir:15715)
called from Sub 'parrot;Perl6;Grammar;Actions;type_declarator' pc
141016 (src/gen_actions.pir:15507)
called from Sub 'parrot;Perl6;Grammar;type_declarator' pc 56741
(src/gen_grammar.pir:15033)
called from Sub 'parrot;Perl6;Grammar;noun' pc 66124 (src/gen_grammar.pir:18653)
called from Sub 'parrot;Perl6;Grammar;expect_term' pc 60939
(src/gen_grammar.pir:16680)
called from Sub 'parrot;PGE;OPTable;parse' pc 1979
(compilers/pge/PGE/OPTable.pir:554)
called from Sub 'parrot;Perl6;Grammar;statement' pc 27186
(src/gen_grammar.pir:3693)
called from Sub 'parrot;Perl6;Grammar;statementlist' pc 24938
(src/gen_grammar.pir:2818)
called from Sub 'parrot;Perl6;Grammar;statement_block' pc 22476
(src/gen_grammar.pir:1847)
called from Sub 'parrot;Perl6;Grammar;TOP' pc 18370 (src/gen_grammar.pir:229)
called from Sub 'parrot;PCT;HLLCompiler;parse' pc 640
(src/PCT/HLLCompiler.pir:390)
called from Sub 'parrot;PCT;HLLCompiler;compile' pc 434
(src/PCT/HLLCompiler.pir:303)
called from Sub 'parrot;PCT;HLLCompiler;eval' pc 868
(src/PCT/HLLCompiler.pir:502)
called from Sub 'parrot;PCT;HLLCompiler;evalfiles' pc 1233
(src/PCT/HLLCompiler.pir:676)
called from Sub 'parrot;PCT;HLLCompiler;command_line' pc 1412
(src/PCT/HLLCompiler.pir:765)
called from Sub 'parrot;Perl6;Compiler;main' pc 16408 (perl6.pir:168)

Wich seem related to line 3025:
$past[0].push($param);

where possibly $past[0] is empty.

A simple solution is to check that the value passed actually is a
regex by verifying the .compiler attribute, and then manage it as just
another literal, constructing a block with smart matching.
The tests pass but I feel the "right" solution may be fixing the
Perl6Regex structure, even because similar code to build the subset
type is used in make_anon_subset.
Sadly, it's the first time I dive into the rakudo source and I do not
feel comfortable doing that.

Attached is the  patch, and my minimal test suite, which should
probably go into the perl6 spec, which tests the definition of subsets
but not with a regex literal.
All tests pass, and spectest behaves the same as the unpatched version.


patch2
Description: Binary data


Re: S16: chown, chmod

2008-12-01 Thread Martin D Kealey
On Tue, 25 Nov 2008, Dave Whipp wrote:
> Brandon S. Allbery KF8NH wrote:
> > Still misunderstanding, I think.  Yes, it will fail anyway, but in the
> > general case you're checking to see if as a privileged process it is safe to
> > operate on a given file.
>
> I'd actually been thinking that one would use the check in the opposite
> direction:
>
> if need_priv() {
>   sudo { ... }; # might ask user for passwd
> }
> else {
>   ...
> }
>
> But then I'm not an expert in this area: I just want an API that makes it easy
> to hack simple scripts that do what I need. It was C that I really
> wanted to improve the API for; I touched C only because it was adjacent
> in the POD, and it seems reasonable for the two functions/methods to have
> similar look&feel.

I've been wondering about this idiom, used when copying files:

  my $s = POSIX::stat($filename1);
  POSIX_extensions::setstat($filename2, $s);

where setstat() is a combination of chown, chmod and utime -- in the right
order to make them work as best as possible. The type of check contemplated
in this thread would then come in handy for implementing setstat().

If an unprivileged user can give away a file then that change has to be the
last thing done to the file. Otherwise changing the permissions should be
done last, so as to maintain the set*id bits. So I would envisage it would
look a bit like this (please excuse my obvious hand-waving pseudocode):

sub setstat(String|File $filename, StatBuf $stat) {
  use fatal :everything;

  if $stat.uid != any(POSIX::getuid(), POSIX::geteuid()) |
 $stat.gid != any(POSIX::getgid(), POSIX::getegid(), POSIX::getgroups()) {

# we need to give the file away

my $caps = POSIX_1e::capget();

if $caps.CAP_FOWNER {
  # we're privileged, so it *should* just work.
  POSIX::chown $filename, $stat.uid, $stat.gid;
  POSIX::chmod $filename, Fcntl::ST_PERM($stat.mode);
  POSIX::utime $filename, $stat.mtime, $stat.atime;
  return;
}
if $caps.CAP_CHOWN | !chown.need_priv() {
  # we have enough privilege to give the file away, but not enough to
  # touch it after we've done so.
  POSIX::chmod $filename, Fcntl::ST_PERM($stat.mode);
  POSIX::utime $filename, $stat.mtime, $stat.atime;
  POSIX::chown $filename, $stat.uid, $stat.gid;
  return;
}
if catching_exception(IO_error) {
  throw IO_error(EPERM, $filename, "Can't give file away");
}
  }
  # can't (or don't need to) give file away
  POSIX::chmod $filename, Fcntl::ST_PERM($stat.mode);
  POSIX::utime $filename, $stat.mtime, $stat.atime;
}

-Martin


Re: how to write literals of some Perl 6 types?

2008-12-01 Thread Carl Mäsak
Darren (>):
>  Bit
>  Blob
>  Set
>  Bag
>  Mapping
>
> How does one write anonymous value literals of those types?  And I mean
> directly, not by writing a literal of some other type and using a conversion
> function to derive the above?

Why is the latter method insufficient for your needs?

// Carl


Re: S16: chown, chmod

2008-12-01 Thread Mark Overmeer
* Martin D Kealey ([EMAIL PROTECTED]) [081202 04:37]:
> On Tue, 25 Nov 2008, Dave Whipp wrote:
> 
> sub setstat(String|File $filename, StatBuf $stat) {
> ...
> if $caps.CAP_FOWNER {
>   # we're privileged, so it *should* just work.
>   POSIX::chown $filename, $stat.uid, $stat.gid;
>   POSIX::chmod $filename, Fcntl::ST_PERM($stat.mode);
>   POSIX::utime $filename, $stat.mtime, $stat.atime;
>   return;
> ...
> if catching_exception(IO_error) {
>   throw IO_error(EPERM, $filename, "Can't give file away");

Implementing things this way is as big a mistake as doing this:
(Perl5 syntax)

   if(-r $fn)
   {   open READ, '<', $fn;
   while(  )

For the two reasons:
  (1) you have a race condition: the permission may change between
  the test and the actual open().  In very rare cases, which
  makes those bug hard to trace
  (2) the check itself is flawed: whether you can chown() does not
  only depend on the OS, but also on the disk: might be a CD-ROM.

The only correct way to implement it, is simply try chown() and
handle the error.  Yes, you need quite more code for that.
-- 
   MarkOv


   Mark Overmeer MScMARKOV Solutions
   [EMAIL PROTECTED]  [EMAIL PROTECTED]
http://Mark.Overmeer.net   http://solutions.overmeer.net