On Mon, 2004-12-13 at 07:44 -0800, Dan Sugalski wrote:
> A plain
>
> ./parrot foo.pbc
>
> when foo.pbc doesn't exist triggers a core dump on OS X.
The problem is in embed.c not checking the results of
Parrot_locate_runtime_file(). Here's a naive patch.
Is there a good place to put tests for this? I'm not sure how the test
harness could invoke this correctly.
-- c
Index: src/embed.c
===================================================================
RCS file: /cvs/public/parrot/src/embed.c,v
retrieving revision 1.125
diff -u -u -r1.125 embed.c
--- src/embed.c 4 Dec 2004 09:09:01 -0000 1.125
+++ src/embed.c 13 Dec 2004 18:33:49 -0000
@@ -223,6 +223,11 @@
fullname = Parrot_locate_runtime_file(interpreter, filename,
PARROT_RUNTIME_FT_PBC);
+ if (!fullname) {
+ PIO_eprintf(interpreter, "Parrot VM: Can't find %s, code %i.\n",
+ filename, errno);
+ return NULL;
+ }
fs = interpreter->current_file = string_make(interpreter, fullname,
strlen(fullname), "iso-8859-1", 0);
if (!Parrot_stat_info_intval(interpreter, fs, STAT_EXISTS)) {