← All bug reports

FS#1493script processing failure using -exec

Type
Bug
Status
Closed
Resolution
Fixed
Category
ECMAScript
Severity
Low
Priority
Low
Reported version
3.15.5
Operating system
Linux (All / Other)
Reported
2016-10-19 by dajo
Closed
2016-10-27 by andrew

I have just updated from 3.11.0 to 3.15.5. Often, I load a script with the command format ..../qcad -exec ..../dims.js Note that the script filename is dims.

* Everything is satisfactory with 3.11.0 and always has been.

* qcad-3.15.5 runs satisfactorily without an -exec switch

* qcad-3.15.5 -exec same-file-as-for-3.11.0 crashes per the attached screenshot. The screenshot has been generated by adding the -enable-script-debugger switch.

* It appears that the script dims.js runs completely, and the crash happens as the script handler terminates. The qcad window is complete with the contents defined in dims.js, also qcad is usable normally. This qcad disappears when the debugger is terminated.

* This problem is totally repeatable.

Comments (11)

andrew 2016-10-20

Please attach your script dims.js.
Please attach the screenshot you have mentioned.
Thanks.

dajo 2016-10-21

I shall be happy to supply dims.js. However, it is over 27000 lines long. Do you still want it?

I have selected the screenshot, but I do not see any upload button, here goes ....

andrew 2016-10-21

Yes, I'd need the file to track down this problem as I cannot reproduce it with any other script.
If you prefer, you can also track the problem by inserting a debugger statement at the beginning of execScripts in autostart.js. I think, that's where something goes wrong. The script is identified as an action class (a class derived from EAction with beginEvent, etc.) which it probably isn't.

dajo 2016-10-21

Here is dims.js.

Has the definition of a script changed between 3.11.0 and 3.15.5?

andrew 2016-10-21

Do you have any other scripts named "dims.js"? It looks like on your system an action with a script "dims.js" is found which QCAD then tries to start as an action (beginEvent).

The script seems to run just fine here.

dajo 2016-10-21

Yes, I do have other scripts named dims.js, also scripts named dims.qs, for qcad2. Normally I run qcad from a desktop launcher using the command below, or an identical command for 3.11.0:
/home/dajo/.qcad/qcad-3.15.5-pro-linux-x86_64/qcad -exec /home/dajo/Railways/portable-railway/current-dims/dims.js
The screenshot shows this command being run from a terminal solely to show the messages as qcad runs.

current-dims is a soft link:
current-dims -> ./vtrack-storage/ where vtrack-storage is another directory containing dims.js; this soft link is changed to access other dims.js files. I have attached another, much smaller dims.js

I have used this arrangement for years. As indicated in my original post there is no difficulty if I use qcad 3.11.0 in exactly the same way. Also, I have just tried 3.7.5, which I still have not deleted from my system, and this runs perfectly well. The problem is new with 3.15.5.

Also, I note in my original post that, if the debugger is enabled, 3.15.5 works apparently successfully. If the -enable-script-debugger switch is used, either in a terminal window, or in a launcher, then I can use qcad, apparently normally. I simply ignore the debug window. It is this that made me write originally that the error appears to occur around the time that the script handler is completing its execution, and after the script has completed.

andrew 2016-10-24

Can you try renaming your dims.js into something else (e.g. mydims.js) and try again?

dajo 2016-10-24

I changed the call in the launcher from dims.js to mydims.js and changed the name of my script output file in my emacs lisp generating code similarly. Also I changed identification names that appear in mydims.js

andrew 2016-10-27

Unfortunately, I have no further ideas and I cannot reproduce the problem here. Maybe you could try it on new, clean installation of QCAD or step through execScripts in autostart.js using the script debugger?

dajo 2016-10-27

I am not sure what you mean by a clean installation; I downloaded 3.15.5 on about 18 October 2016 and installed it; is that clean? I can try installing on another machine, but first I should like to pursue the current installation.

Please tell me where to read about using the script debugger; I have not been able to find the documentation.

Understanding the full implications of the control logic in execScripts will take some time because of the two sets of code handling the null action case and I have no knowledge of the called code. However, I can tell you that commenting lines 223-237 in autostart.js does eliminate the run problem that I have.

            // run existing action:
            var action = RGuiAction.getByScriptFile(args[i]);
///            if (isNull(action)) {
///                // gui action might not exist yet for this script, create one:
///                var resPath = args[i];
///                action = new RGuiAction("");
///                if (!new QFileInfo(resPath).exists()) {
///                    resPath = ":/" + resPath;
///                }
///                if (!new QFileInfo(resPath).exists()) {
///                    action = undefined;
///                }
///                else {
///                    action.setScriptFile(resPath);
///                    action.setRequiresDocument(false);
///                }
///            }

            if (!isNull(action)) {