Mantis Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0002046I6 LibraryGeneralpublic2017-12-23 08:102018-09-12 01:14
Reporterturthalion 
Assigned ToDavidG 
PrioritynormalSeverityseriousReproducibilityalways
StatusresolvedResolutionfixed 
Platformx86OSWindowsOS Version7
Product Version6/11 
Target VersionFixed in Version 
Summary0002046: "undo" after replay input crashes Glulx interpreter
DescriptionCompiled using Inform v6.33 Library v6.12.1 S).

After I replay a command script, even one of only one command, issuing "undo" causes Git and Glulxe report:
Reference to non-existent Glk object

Lectrote is, as expected more helpful, showing:
Quixe run: glk_get_line_stream: invalid stream

If, without replaying, I take the same command, I can type it in, hit <ENTER> and then type 'undo' and nothing untoward happens.

I've got a minimal example (attached) that demonstrates this.

If it is compiled with -~D in any way, then it crashes when you type undo after inputting a replay file.

in parserm.h in GGRecoverObjects (line 6491 in mine), there's the following:

#Ifdef DEBUG;
gg_commandstr = 0;
gg_command_reading = false;
#Endif; ! DEBUG

and a bit further down inside the switch sstatement (line 6503):
            #Ifdef DEBUG;
            GG_COMMANDWSTR_ROCK: gg_commandstr = id;
                                 gg_command_reading = false;
            GG_COMMANDRSTR_ROCK: gg_commandstr = id;
                                 gg_command_reading = true;
            #Endif; ! DEBUG

So we only wipe gg_commandstr and clear gg_command_reading when it's a debug build (which, unsurprisingly, is when it works properly for me, not crashing). If it's a release build, gg_commandstr is not cleared.

During discussion at intfiction.org (thread: https://www.intfiction.org/forum/viewtopic.php?f=7&t=25197&p=138447 [^]), zarf had the following to say:
"I don't know why the gg_commandstr lines in GGRecoverObjects() are conditionalized with "#ifdef DEBUG". There's no good reason for that, except maybe the expectation that the RECORD command will only be used on debug builds, which is not a good assumption. You can just remove the "#ifdef" lines there."

So I thought I'd post this here and see if anyone knows of a reason those #Ifdefs are there. I can verify that removing both sets seems to address my issue.
Minimal Source Text To Reproduce
Constant Story "Test bed";
Constant Headline
    "^An Interactive Tester^
    No copyright asserted^";

Release 0; Serial "171223";

Include "Parser";
Include "VerbLib";

Object  garden "Beautiful Garden"
  with	description "An apple tree provides shade. The kitchen lies east.",
        e_to Kitchen,
  has   light;

Object -> "feather"
  with  name 'feather',
        description "It's a feather.";

Object  kitchen "Kitchen",
  with  description "This is a large country-style kitchen.",
        w_to Garden,
  has   light;

Object	->	plain_bag "plain shopping bag"
	with	name 'plain' 'shopping' 'bag',
			description "A plain shopping bag that can hold 2 things.",
      capacity 2,
      has open container;

Object -> "fork"
  with  name 'fork',
        description "It's a fork.";

[ Initialise;

    location = garden;
    lookmode = 2;
    print "^^This is a simple game for bug-testing.^^^";
    Banner(); return 2;
];

Include "Grammar";
Additional Information- compile the above game (or, I believe any game) to Glulx with debug disabled
- create a command replay file with just a command or two, replay it into the game and type undo.

The interpreter will crash.
TagsNo tags attached.
Attached Files

- Relationships

-  Notes
(0004811)
DavidG (developer)
2018-09-12 01:01

>recording on
[Command recording on.]

>take feather
Taken.

>recording off
[Command recording off.]

>replay
[Replaying commands.]

>take feather
You already have that.

>recording off
[Command replay complete.]

>undo
Beautiful Garden
[Previous turn undone.]

>
--------------------------------------------------------------------------------
Glulxe fatal error: Reference to nonexistent Glk object.

 Hit any key to exit.
(0004812)
DavidG (developer)
2018-09-12 01:09

Cross reported to https://gitlab.com/DavidGriffith/inform6lib/issues/55 [^]
(0004813)
DavidG (developer)
2018-09-12 01:14

Fixed in https://gitlab.com/DavidGriffith/inform6lib/commit/74df3809e58fef5f967142d12e3f7573dbfee6b2 [^]

- Issue History
Date Modified Username Field Change
2017-12-23 08:10 turthalion New Issue
2018-09-12 01:01 DavidG Note Added: 0004811
2018-09-12 01:09 DavidG Note Added: 0004812
2018-09-12 01:14 DavidG Assigned To => DavidG
2018-09-12 01:14 DavidG Status new => assigned
2018-09-12 01:14 DavidG Note Added: 0004813
2018-09-12 01:14 DavidG Status assigned => resolved
2018-09-12 01:14 DavidG Resolution open => fixed


Copyright © 2000 - 2010 MantisBT Group
Powered by Mantis Bugtracker