Bugs item #2838961, was opened at 2009-08-17 22:36 Message generated for change (Tracker Item Submitted) made by justinjohansson You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=713730&aid=2838961&group_id=129076
Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: Command-line Client Group: Sedna (current) Status: Open Resolution: None Priority: 5 Private: No Submitted By: Justin Johansson (justinjohansson) Assigned to: Nobody/Anonymous (nobody) Summary: se_* utilities exhibit inappropriate exit behaviour Initial Comment: This bug relates to nearly all se_* command line utilities though for the purpose of this report se_gov is taken as example. This is a serious issue for users that write programs that spawn se_* command line processes and monitor error activity on stderr and process exit codes. It is also an issue for the submitter of this bug who desires to develop new -xml command line option for Sedna utilities per previous discussions. Observation: "se_gov -version" issues version information as one would expect on stdout but exits with process exit code = 1 and emits an extraneous newline character on stderr. Complaint: "se_gov -version" is valid user input and, unless se_gov does not know what version he is, he should issue version information on stdout and then exit with code = 0 and write absolutely nothing to stderr .. not even a single whitespace character!!! Diagnosis: In kernel/gov/gov.cpp the programmer uses an exception to exit se_gov rather than fall through normal block scope. btw Ed Dijkstra (http://en.wikipedia.org/wiki/Edsger_W._Dijkstra) would roll over in his grave seeing this travestry. if (gov_version == 1) { print_version_and_copyright("Sedna Governor"); throw USER_SOFT_EXCEPTION(""); } When exception is caught it code then issues a trivial error message consisting of a single newline character to stderr and then process summarily terminates with exit code = 1. Of course the casual user just sees the version text written to stdout, but a process monitor sees output written to both stdout and stderr and a non-zero exit code! Remedy: While it would be better to exit via normal flow control rather than an exception, the quick fix is to modify the catch block (gov.cpp ~line 279) as follows: gov.cpp near line 279 } catch (SednaUserException &e) { event_logger_release(); if (!is_pps_close) { if (pps) pps->shutdown(); } // Check for a trivial exception message. This implies // (as a result of the way the code uses exceptions // to exit quickly rather than using normal flow control // idioms in non-exceptional circumstances) that the process // should exit gracefully without anything being written // to stderr (not even a single newline character!) and // together with process exit code = 0. Otherwise write // the non-trivial exception message to stderr and exit // the process with exit code != 0. const char* what = e.what(); if (what && *what) { // non-trivial exception message fprintf(stderr, "%s\n", e.what()); return 1; } // trivial exception message return 0; } catch (SednaException &e) { Cheers Justin Johansson ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=713730&aid=2838961&group_id=129076 ------------------------------------------------------------------------------ Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july _______________________________________________ Sedna-discussion mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/sedna-discussion
