cfry / dde

Dexter Development Environment
Other
44 stars 25 forks source link

Direct use of 'r' oplet "shouldnt"s, and JE has no "shouldnt" #93

Open JamesNewton opened 1 year ago

JamesNewton commented 1 year ago

In DDE 3.8.12, the r_op_ok job shown below runs to completion, the r_op_fail job fails with:

Error: The function: shouldnt has been called. This means there is a bug in DDE. Please send a bug report. See User_Guide/Contact. Include this whole message. find_read_file_instance_on_do_list failed to find an instance of Dexter.read_file on Job.r_op_fail.do_list at or before instruction: 0 Error at dde_error (file:///home/jamesn/dde/core/je_and_browser_code.js:14:15) at shouldnt (/home/jamesn/dde/core/utils.js:7:5) at Function.find_read_file_instance_on_do_list (/home/jamesn/dde/core/instruction_dexter.js:797:9) at Function.got_content_hunk (/home/jamesn/dde/core/instruction_dexter.js:810:39) at Function.r_payload_grab_aux (/home/jamesn/dde/core/socket.js:706:38) at Function.r_payload_grab (/home/jamesn/dde/core/socket.js:699:16) at Function.on_receive (/home/jamesn/dde/core/socket.js:620:20) at Socket. (/home/jamesn/dde/core/socket.js:69:28) at Socket.emit (events.js:194:13) at addChunk (_stream_readable.js:296:12) at readableAddChunk (_stream_readable.js:277:11) at Socket.Readable.push (_stream_readable.js:232:10) at TCP.onStreamRead (internal/stream_base_commons.js:165:17)


new Job({
    name: "r_op_ok",
    do_list: [
        Dexter.read_file("AdcCenters.txt"), //this works and sends 'r 0 AdcCenters.txt'
        make_ins("r", "0", "AdcCenters.txt"), //this seems to work, IF the read_file is done first
        "r 0 AdcCenters.txt", //this also works /after/ the read_file.
        "r 0 Defaults.make_ins" //this also works /after/ the read_file so it's not just cacheing 
    ]})

new Job({
    name: "r_op_fail",
    do_list: [
        //Dexter.read_file("AdcCenters.txt"), //this works, but if we don't start with it, then...
        make_ins("r", "0", "AdcCenters.txt"), //this fails with a shouldn't 
        //also, "shouldnt" isnt defined in the job engine
        "r 0 AdcCenters.txt" //this also fails the same way.
    ]})

I'm guessing something isn't getting initialized in the 'r' oplet return handler?

Ideally, if the user didn't call .read_file then the 'r' oplet return value should just be copied into the return status and /nothing/ else should happen. e.g. don't molest raw opcodes, or their return values. We are already doing the first part (passing raw opcode right through) but we should also do the latter.

Practically, this is probably a non-issue. Although it did cost me more than a few hours, but now that I sort of understand what is happening, I think I can work around it on the DexTractor. And that fact that "shouldnt" doesn't seem to be defined in the dde3_je is a real issue

<for_server>{"kind":"out_call","val":"Job: sim_status pc: 7 <progress style='width:100px;' value='7' max='9'></progress> of 9. Last instruction sent: r 0 AdcCenters.txt &nbsp;&nbsp;<button onclick='inspect_out(Job.sim_status)'>Inspect</button>","color":"#5808ff","temp":"sim_status1672185870157","code":null}</for_server>
/srv/samba/share/dde3_je/core/instruction_dexter.js:797
        shouldnt("find_read_file_instance_on_do_list failed to find<br/>" +
        ^

ReferenceError: shouldnt is not defined
    at Function.find_read_file_instance_on_do_list (/srv/samba/share/dde3_je/core/instruction_dexter.js:797:9)
    at Function.got_content_hunk (/srv/samba/share/dde3_je/core/instruction_dexter.js:810:39)
    at Function.r_payload_grab_aux (/srv/samba/share/dde3_je/core/socket.js:706:38)
    at Function.r_payload_grab (/srv/samba/share/dde3_je/core/socket.js:699:16)
    at Function.on_receive (/srv/samba/share/dde3_je/core/socket.js:620:20)
    at Socket.<anonymous> (/srv/samba/share/dde3_je/core/socket.js:69:28)
    at Socket.emit (node:events:527:28)
    at addChunk (node:internal/streams/readable:324:12)
    at readableAddChunk (node:internal/streams/readable:297:9)
    at Socket.Readable.push (node:internal/streams/readable:234:10)