Closed
Bug 1321806
Opened 8 years ago
Closed 8 years ago
Error out if version range cannot be parsed
Categories
(NSS :: Tools, defect)
NSS
Tools
Tracking
(Not tracked)
RESOLVED
FIXED
3.29
People
(Reporter: ueno, Unassigned)
Details
Attachments
(1 file, 1 obsolete file)
1.83 KB,
patch
|
KaiE
:
review+
|
Details | Diff | Splinter Review |
When running selfserv/strsclnt/tstclnt with -V ssl2: or any other non-parsable version range, it prints the help message and continue running. I think it would make more sense to abort when the tools see an invalid version range.
Reporter | ||
Updated•8 years ago
|
Attachment #8816449 -
Flags: review?(kaie)
Comment 1•8 years ago
|
||
I think the tools don't continue to run after the bada parameters are detected. You don't need to call exit(), because the function Usage() calls exit() after printing the usage message. Many places in the parameter parsing already call Usage() to exit on failure, I think the call to PL_DestroyOptState(optstate) is unnecessary, since almost none of the existing places do it. I agree that it's a good idea to print the additional message that explains which parameter exactly was incorrect. I think we don't need to print the statement "-h for usage", because the usage is printed by default, when executed without commands, so it's trivial to discover the usage. I suggest to simplify your patch, and only add the fprint("Bad...") statement prior to the existing call to Usage(). In other words, I suggest to replace Usage(progName); with fprintf(stderr, "Bad version for parameter -V specified.\n"); Usage(progName); Or alternatively, if you don't like that the error message might potentially scroll out, because the Usage output is very long, you could also use: fprintf(stderr, "Bad version for parameter -V specified.\n"); exit(1); (It seems that tstclnt consistently uses exit code 1 for all scenarios that fail to parse the parameters.)
Updated•8 years ago
|
Attachment #8816449 -
Flags: review?(kaie)
Reporter | ||
Comment 2•8 years ago
|
||
Thank you for the review. I'm attaching an updated patch, which should address the issues. One thing, however, is that selfserv.c:Usage doesn't call exit() and even has a '-h' option that calls exit(0) after Usage(). Perhaps it might be better to remove the option and always call exit() in Usage(), for consistency.
Attachment #8816449 -
Attachment is obsolete: true
Attachment #8817391 -
Flags: review?(kaie)
Comment 3•8 years ago
|
||
Thank you for explaining the difference in selfserv. Establishing complete consistency might require more work, to ensure it doesn't create new side effects. The exit() statement that you added seems like a good minimal solution for now.
Updated•8 years ago
|
Attachment #8817391 -
Flags: review?(kaie) → review+
Comment 4•8 years ago
|
||
https://hg.mozilla.org/projects/nss/rev/e2804da8af30
Status: NEW → RESOLVED
Closed: 8 years ago
Resolution: --- → FIXED
Target Milestone: --- → 3.29
You need to log in
before you can comment on or make changes to this bug.
Description
•