-
-
Notifications
You must be signed in to change notification settings - Fork 23
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Inconsistencies in Maiko command line arg processing for sysouts #1703
Comments
starts up fine with the sysout (using ldex), producing an X window with title "FOO". Neither LDESOURCESYSOUT nor LDESRCESYSOUT were set. Can you give me one with different arguments that exhibits the failure.
|
Re: the
|
@nbriggs One more condition for bug to appear: you cannot have a sysout specified in any of the X resource databases (.Xresources etc). Check out code in xrdopt.c: Lines 184-198 and then Lines 246-253 (in master). Given all of the conditions I specified, the check starting at line 250 will result in an immediate error exit before the first sysout argument is processed. |
Except it doesn't. From the XrmParseCommand() man page --
so when it's all done, the remaining command line has argc=2, and argv[1] is the sysout name which was not recognized by the X option parser.
However, it WILL fail if you pass it an option that has not been added to the X options table, because then argc will not be 2 after the |
Actually, the non-X options that can't be specified in the Xresources database (should there be any of those?) need to be accounted for, in the main code, and it shouldn't check for argc==2, but might check that the first remaining argument doesn't start with "-" and use it as the sysout name and then press on to parse any remaining options. |
Yes, you are right about the failure conditions - there must be one additional argument that is not in the X windows arg table. But then there are lots of args not in the X windows arg table - the nethub stuff for one example. Also args like pixelscale, which apply only to SDL but should just be ignored by X windows. And we could fix up the immediate bug by just getting rid of the argc = 2 gate (and checking for -). But, my main problem is that the way its designed is just bad software design for a cross-platform app for a couple of reasons:
In the PR that I submitted, I tried to address both of these issues to better rationalize the handling of sysout args. |
I don't have any complaint about the PR other than the comments should be a bit clearer about what's going on (since you're going making this effort to make the code clearer). We should certainly not encourage people to do things like |
In Maiko, processing of command line arguments for sysout has lots of inconsistencies.
The -sysout argument can only be used when using X Windows. On non-X platforms, there is no -sysout argument.
Bug: On X windows only: if 1) the sysout is specified as the first argument to lde, 2) there are additional command line arguments, 3) the env variables LDESOURCESYSOUT and LDESRCESYSOUT are not set, and 4) there is no file $HOME/lisp.virtualmem, THEN lde will immediately exit with a "can't find a sysout" error message - despite the fact that the sysout given as the first command line arg is a valid syspout file. This bug does not happen on SDL platforms - e.g., cygwin.
In general, sysout args are processed twice on X-windows platforms - once in xrdopt.c (specific to X) and once in main.c (for all platforms). The processing in these two places is both redundant and, more importantly, inconsistent. The above bug is caused by faulty processing of the sysout argument in the xrdopt.c code (looks at the first command line argument only if argc == 2).
The text was updated successfully, but these errors were encountered: