imagej / imagej-launcher

The ImageJ native launcher
https://imagej.net/learn/launcher
BSD 2-Clause "Simplified" License
21 stars 23 forks source link

Unknown options cause startup failure #13

Closed ctrueden closed 10 years ago

ctrueden commented 10 years ago
$ Contents/MacOS/ImageJ-macosx --foo
Jun 10 16:17:00 sirius ImageJ-macosx[46469] <Error>: The function `CGContextErase' is obsolete and will be removed in an upcoming update. Unfortunately, this application, or a library it uses, is using this obsolete function, and is thereby contributing to an overall degradation of system performance.
Unrecognized option: --foo
Warning: falling back to System JVM
The process has forked and you cannot use this CoreFoundation functionality safely. You MUST exec().
Break on __THE_PROCESS_HAS_FORKED_AND_YOU_CANNOT_USE_THIS_COREFOUNDATION_FUNCTIONALITY___YOU_MUST_EXEC__() to debug.
The process has forked and you cannot use this CoreFoundation functionality safely. You MUST exec().
Break on __THE_PROCESS_HAS_FORKED_AND_YOU_CANNOT_USE_THIS_COREFOUNDATION_FUNCTIONALITY___YOU_MUST_EXEC__() to debug.
ctrueden commented 10 years ago

Maybe the startup failure itself is not a problem, but certainly the scary "THE_PROCESS_HAS_FORKED" etc. messages are undesired? What do you think, @dscho?

dscho commented 10 years ago

Whoa... If you pass --foo it should be added as an ImageJ option, not JVM option. Will investigate tomorrow.

dscho commented 10 years ago

Heh... This is actually correct, because the code was designed to put all options that are known not to be ImageJ 1.x options into the Java options part:

https://github.com/imagej/imagej-launcher/blob/be045dd10008c22795b271be9a4edba40020d133/src/main/c/ImageJ.c#L1845-L1855

IIRC it was your idea, @ctrueden ;-)

dscho commented 10 years ago

So maybe you want to invert the logic and pass only all known Java options to the JVM when there is no --? It's doable...

ctrueden commented 10 years ago

Right. The original rationale was that IJ1 had a relatively small set of known options, and we could always whitelist them. But with the extensible nature of IJ2, it makes more sense to instead whitelist the Java options, which while extensive are relatively more static by comparison. Doable, but not the highest priority unfortunately. Issue #14 filed.

dscho commented 10 years ago

So let's close this ticket in deference to #14.

ctrueden commented 10 years ago

But, the scary THE_PROCESS_HAS_FORKED errors are still present, no? So isn't this issue still valid?

dscho commented 10 years ago

But, the scary THE_PROCESS_HAS_FORKED errors are still present, no?

Well, no, once we handle the arguments properly, there will not be a fallback to system JVM, and consequentially also no scary errors... ;-)