QCAD Bugtracker

  • Status Closed
  • Percent Complete
    100%
  • Task Type Bug Report
  • Category ECMAScript
  • Assigned To
    Andrew
  • Operating System Linux (All / Other)
  • Severity Low
  • Priority Very Low
  • Reported Version 3.15.5
  • Due in Version Undecided
  • Due Date Undecided
  • Votes
  • Private
Attached to Project: QCAD Bugtracker
Opened by David Outteridge - 19.10.2016
Last edited by Andrew - 27.10.2016

FS#1493 - script processing failure using -exec

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.

Closed by  Andrew
27.10.2016 18:50
Reason for closing:  Fixed
Admin
Andrew commented on 20.10.2016 06:41

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

David Outteridge commented on 21.10.2016 00:17

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 ....

Admin
Andrew commented on 21.10.2016 07:34

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.

David Outteridge commented on 21.10.2016 14:27

Here is dims.js.

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

   dims.js (1.11 MiB)
Admin
Andrew commented on 21.10.2016 15:15

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.

David Outteridge commented on 21.10.2016 19:42

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.

   dims.js (17.4 KiB)
Admin
Andrew commented on 24.10.2016 07:20

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

David Outteridge commented on 24.10.2016 17:06

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

Admin
Andrew commented on 27.10.2016 11:54

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?

David Outteridge commented on 27.10.2016 18:19

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)) {
Admin
Andrew commented on 27.10.2016 18:50

Thanks, that makes sense actually. I was now able to reproduce the problem (passing an absolute path to -exec). The problem has been fixed for the next release. You can download the new autostart.js from:
https://raw.githubusercontent.com/qcad/qcad/master/scripts/autostart.js

Loading...

Available keyboard shortcuts

Tasklist

Task Details

Task Editing