Hello,
I have just tried to sign my own scripts for the first time, so I don't know if I got everything else right.
However, I have found some steps to consequently produce a crash of the PixInsight application. Steps to reproduce:
1. Create two script files: "module.js", "main.js" (Names chosen for readability)
Content of main.js:
Content of module.js:
2. Add main.js to the CodeSign script
3. Enter Password and click "Run"
4. PixInsight crashes after a few seconds.
Additional information/context:
The scripts produce a cyclic dependency, since main.js is importing module.js which in turn is importing main.js and so on. This is prevented, during execution, by the "header guards" (or whatever the correct name in PJSR terms is). Executing main.js works fine. Using the "Check Script File Syntax" option on main.js also works fine.
So I assume that having such cyclic imports is fine, as long as they are inside some header guards.
However, commenting out/enabling again line 4 ("#include "./main.js") in module.js consistently causes the CodeSign script to crash the PixInsight application.
OS/HW information:
- OS: Windows 11 Pro (23H2, build 22631.5189)
- Ryzen 7 2700x
- 32gb DDR4 RAM
- WQHD screen
I don't know if this is invoking undefined behaviour, but since such scripts are executable just fine, and this represents a not uncommon scenario, I assume that this is to be considered a bug.
Let me know if you need further information or whatever!
CS Gerrit
I have just tried to sign my own scripts for the first time, so I don't know if I got everything else right.
However, I have found some steps to consequently produce a crash of the PixInsight application. Steps to reproduce:
1. Create two script files: "module.js", "main.js" (Names chosen for readability)
Content of main.js:
JavaScript:
#ifndef CYCLIC_IMPORT_MAIN
#define CYCLIC_IMPORT_MAIN
#feature-id TestScript : Test > Script
#include "./module.js"
function funcMain()
{
console.writeln("funcMain");
}
funcMain();
#endif
Content of module.js:
JavaScript:
#ifndef CYCLIC_IMPORT_MODULE
#define CYCLIC_IMPORT_MODULE
#include "./main.js"
function funcModule()
{
console.writeln("funcModule");
}
funcModule();
#endif
2. Add main.js to the CodeSign script
3. Enter Password and click "Run"
4. PixInsight crashes after a few seconds.
Additional information/context:
The scripts produce a cyclic dependency, since main.js is importing module.js which in turn is importing main.js and so on. This is prevented, during execution, by the "header guards" (or whatever the correct name in PJSR terms is). Executing main.js works fine. Using the "Check Script File Syntax" option on main.js also works fine.
So I assume that having such cyclic imports is fine, as long as they are inside some header guards.
However, commenting out/enabling again line 4 ("#include "./main.js") in module.js consistently causes the CodeSign script to crash the PixInsight application.
OS/HW information:
- OS: Windows 11 Pro (23H2, build 22631.5189)
- Ryzen 7 2700x
- 32gb DDR4 RAM
- WQHD screen
I don't know if this is invoking undefined behaviour, but since such scripts are executable just fine, and this represents a not uncommon scenario, I assume that this is to be considered a bug.
Let me know if you need further information or whatever!
CS Gerrit