Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

[perl #38850] [BUG] Getopt/Obj.pir dies on non-existent options

4 views
Skip to first unread message

Allison Randal

unread,
Apr 4, 2006, 7:52:49 PM4/4/06
to bugs-bi...@rt.perl.org
# New Ticket Created by Allison Randal
# Please include the string: [perl #38850]
# in the subject line of all future correspondence about this issue.
# <URL: https://rt.perl.org/rt3/Ticket/Display.html?id=38850 >


When you pass a non-existent option to the "get_options" method in
Getopt::Obj, it tries to clear a non-existent exception handler at
the end of the method and dies. (I discovered this by accident, when
I mistyped the "output" option as "outfile". )

$ parrot tgc.pir --outfile=dummy.pir ../../examples/tge/branch/branch.g
No exception to pop.
current instr.: 'Getopt::Obj :: get_options' pc 759 (/Volumes/
lilalUFS/projects/svk/parrot/runtime/parrot/library/Getopt/Obj.pir:
344)called from Sub 'main' pc 45 (tgc.pir:51)

Looks like more exceptions are being thrown than the author expects,
but I don't have time to look into it further at the moment.

Allison

Bob Rogers

unread,
Apr 6, 2006, 9:53:43 PM4/6/06
to perl6-i...@perl.org, bugs-bi...@rt.perl.org
From: Allison Randal (via RT) <parrotbug...@parrotcode.org>
Date: Tue, 04 Apr 2006 16:52:49 -0700

Allison

I'll bet that this is because of the "Restrict clear_eh to handlers in
the current context" patch that Leo committed at my suggestion (see
r11444). As a result, one can no longer pop a handler that does not
exist, either because it wasn't pushed, isn't at the top of the control
stack, or wasn't pushed in the current context.

In the case of runtime/parrot/library/Getopt/Obj.pir, it may be that
the handler was already thrown to. If that is true, then the following
patch should be sufficient to correct the problem. But I can't
reproduce the error (can't find tgc.pir; is it attached to the RT item
somewhere?), so I can't test it.

HTH,

-- Bob Rogers
http://rgrjr.dyndns.org/

------------------------------------------------------------------------
Index: runtime/parrot/library/Getopt/Obj.pir
===================================================================
--- runtime/parrot/library/Getopt/Obj.pir (revision 11792)
+++ runtime/parrot/library/Getopt/Obj.pir (working copy)
@@ -334,7 +334,7 @@
rethrow $P0
endif_6:
$I0 = self."notOptStop"()
- if $I0 goto finish
+ if $I0 goto eh_finish
# This seems necessary...don't know why
push_eh handler
inc i
@@ -342,6 +342,7 @@

finish:
clear_eh
+eh_finish:
.return(return)
.end

0 new messages