fuzzball-muck / fuzzball-muf

8 stars 12 forks source link

HLM/cmd-programs.muf is non-functional in starter.db/when installed. #42

Closed KETNAR closed 4 weeks ago

KETNAR commented 4 weeks ago

What it says on the tin, program very much not happy.

Either from starter.db or any install of it, results are the same. Not sure why, sorry.. my .muf is still very crusty at the moment. I fiddled around with the lines that are misbehaving, and didn't have much luck with it. (barely more functional than it is right now.)

Most input crashes it, but bad input (like '#brotato' or just #####) results in it just printing out its output header as if all is normal and nothing was found.


programs
 Dbref Name                     Author               Owner      Modified @view
Programmer Error.  Please tell Keeper what you typed, and the following message.
cmd-programs(#72), line 28; FINDNEXT: Expected player argument. (2)
System stack backtrace:
  0) cmd-programs(#72) line 28, in main(:
 28:         vowner @ "*" vflags @ findnext  ( db )
tanabi commented 4 weeks ago

I probably won't get to looking at it tonight, but I'll try to take a look tomorrow and see if I can sort it out for you.

KETNAR commented 4 weeks ago

Not super urgent, I'm just making sure any issues I come across (and can confirm they come from the git sources and not pebkac) are documented so they can be known and addressed..

..whenever. :)

natmeox commented 4 weeks ago

Hmm, could this possibly be due to a change in Fuzzball v7.2? findnext is documented as accepting #-1 as the second argument:

If d2 is #-1 then ownership checks will not be performed. However, only programs with a mucker level of 3 or better will be allowed to perform non-owner-specific searches, or searches with an owner different from the effective UID of the program.

However this minimal example appears to also throw the indicated error on a current Fuzzball (Muck2.2fb7.21):

: main #-1 #-1 "" "" findnext ;
Program Error.  Your program just got the following error.
mlem(#9619), line 1; FINDNEXT: Expected player argument. (2)
System stack backtrace:
  0) mlem(#9619) line 1, in main(:
  1: : main #-1 #-1 "" "" findnext ;
*done*

Looks like this change to prim_findnext() (that is, at new line 2528 of src/p_db.c) may have inadvertently disallowed use of #-1 as the owner argument to findnext?


-    if (!valid_player(oper2) && (oper2->data.objref != NOTHING))
+    if (!valid_player(oper2)) {
         abort_interp("Expected player argument. (2)");

As indicated farther down on new line 2545, findnext expects who to possibly be NOTHING, which it can't be if we've only allowed valid_player(oper2) cases past line 2528. Could that be the source of the error? 🤔

When I try the original installed version of programs, I still see the error with #badinput arguments — however I don't see the error when I successfully use programs #mine, which makes sense as that's when programs will pass a player (me @) as argument 2, as the error says it expects.

> programs #mine blep
 Dbref       Name                     Author           Owner      Modified @v
 #9632LM3    blep                                      Natasha    01/26/19 no  
[%] Done.

If I install the version of programs published here then I see it does omit the error with #blah arguments… as they also activate #mine mode, which oddly #mine doesn't?

> fuzzball-muf-programs #brotato blep
 Dbref Name                     Author               Owner      Modified @view
 #9632 blep                                          Natasha    01/26/19 no  
Done.
> fuzzball-muf-programs #mine blep
 Dbref Name                     Author               Owner      Modified @view
Program Error.  Your program just got the following error.
cmd-programs(#9618), line 28; FINDNEXT: Expected player argument. (2)
System stack backtrace:
  0) cmd-programs(#9618) line 28, in main(:
 28:         vowner @ "*" vflags @ findnext  ( db )
*done*

Seems like there's an additional issue here in the updated argument matching: I guess I must have accidentally reversed the test when removing HLM's custom support for #help? 😬 Like in the working version I see these lines are:

    dup if  ( strX )
        case
            "help" stringcmp not when .showhelp exit end
            "mine" stringcmp not when

so it should still be "mine" stringcmp not if (with a not) to activate #mine mode, yeah?

That the #blah arguments inadvertently put programs in #mine mode makes it make sense that they suppress the error, though: findnext gets a real player argument (me @) instead of the #-1 that's not currently supported in 7.2, so no error.

KETNAR commented 4 weeks ago

Hmm, could this possibly be due to a change in Fuzzball v7.2? findnext is documented as accepting #-1 as the second argument:

Thank you for confirming what was eating at me. I thought similar, but I'm not versed enough in the system as of yet to know what I'm talking about with confirmed confidence on that one.

This breaks it down wonderfully.

tanabi commented 4 weeks ago

Created issue https://github.com/fuzzball-muck/fuzzball/issues/734 to fix this in the MUCK server itself. Thanks @natmeox for the thorough sleuthing here :)

tanabi commented 4 weeks ago

I just put in a PR that fixes this in the main repo, so I'm closing this issue. Confirmed progarms now works.